T-Engine

Welcome to the t-engine Bug Tracker

Please note that this is a tracker for ToME 3 issues. Please list any ToME 2 issues on the ToME wiki.

For information on the wiki format used for the tickets and comments, see the Dokuwiki Syntax Reference.

Thanks,
Eric (sdltome-at-gmail:dot:com)

| Tasklist |

FS#188 - PhysFS-related memory leaks

Attached to Project: T-Engine
Opened by Nerdanel (nerdanel) - Monday, 29 June 2009, 15:15 GMT-7
Task Type Bug Report
Category T-Engine
Status New
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version alpha18
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Valgrind shows the following two memory leaks that are related to PhysFS and its PHYSFS_getDependentPath. These are not PhysFS leaks but rather failures to delete a string that originates in PhysFS.

==10454== 167 bytes in 3 blocks are definitely lost in loss record 10,508 of 13,164                 
==10454==    at 0x4C234C0: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)        
==10454==    by 0x489FD2: __PHYSFS_platformCvtToDependent (posix.c:207)                             
==10454==    by 0x487A09: PHYSFS_getDependentPath (physfs.c:2113)                                   
==10454==    by 0x4A539C: toluaI_physfs_fs_get_dependent_path00 (w_fs.c:169)                        
==10454==    by 0x4F3886: luaD_call (ldo.c:139)                                                     
==10454==    by 0x4FD6AD: luaV_execute (lvm.c:382)                                                  
==10454==    by 0x4F38B0: luaD_call (ldo.c:182)                                                     
==10454==    by 0x4FD6AD: luaV_execute (lvm.c:382)                                                  
==10454==    by 0x4F38B0: luaD_call (ldo.c:182)                                                     
==10454==    by 0x4F3C7E: f_call (ldo.c:216)                                                        
==10454==    by 0x4F3418: luaD_runprotected (ldo.c:377)                                             
==10454==    by 0x4F34C9: lua_call (ldo.c:225)                                                      
==10454==    by 0x4F3765: lua_dofile (ldo.c:291)                                                    
==10454==    by 0x495E9C: tome_dofile_anywhere (script.c:815)                                       
==10454==    by 0x495F38: init_lua_init (script.c:696)                                              
==10454==    by 0x4408E0: init_angband (init2.c:1008)                                               
==10454==    by 0x44B33C: main (main.c:774)                                                         
==10454== 1,013 bytes in 22 blocks are definitely lost in loss record 11,193 of 13,164              
==10454==    at 0x4C234C0: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)        
==10454==    by 0x489FD2: __PHYSFS_platformCvtToDependent (posix.c:207)                             
==10454==    by 0x487A09: PHYSFS_getDependentPath (physfs.c:2113)                                   
==10454==    by 0x4A539C: toluaI_physfs_fs_get_dependent_path00 (w_fs.c:169)                        
==10454==    by 0x4F3886: luaD_call (ldo.c:139)                                                     
==10454==    by 0x4FD6AD: luaV_execute (lvm.c:382)                                                  
==10454==    by 0x4F38B0: luaD_call (ldo.c:182)                                                     
==10454==    by 0x4FD6AD: luaV_execute (lvm.c:382)                                                  
==10454==    by 0x4F38B0: luaD_call (ldo.c:182)                                                     
==10454==    by 0x4F3C7E: f_call (ldo.c:216)                                                        
==10454==    by 0x4F3418: luaD_runprotected (ldo.c:377)                                             
==10454==    by 0x4F34C9: lua_call (ldo.c:225)                                                      
==10454==    by 0x4F3765: lua_dofile (ldo.c:291)                                                    
==10454==    by 0x495E9C: tome_dofile_anywhere (script.c:815)                                       
==10454==    by 0x44F1F6: select_module (modules.c:127)                                             
==10454==    by 0x440683: init_angband (init2.c:922)                                                
==10454==    by 0x44B33C: main (main.c:774)                                                         

In the C code strings are deleted with string_free. It looks like string_free needs to be made available to Lua.

This task depends upon

Comment by Nerdanel (nerdanel) - Tuesday, 30 June 2009, 04:12 GMT-7

I tried deleting with string_free in Lua and it didn't change the Valgrind output any.

Comment by Nerdanel (nerdanel) - Tuesday, 30 June 2009, 07:22 GMT-7

I added some FIXME notes in the code. I have no idea how to free the strings properly but I know where they leak.

Loading...