freedynamicdata() adjustment
The location of the call to dobjsfree() in freedynamicdata()
appears to have been non-ideal.
After getting complaints from a leak-sensing tool after
#quit, the source of the leaks was investigated.
The call to dobjsfree() had been placed immediately following
a call to dmonsfree(), and it did clear out the go.objs_deleted
chain at that point.
Further investigation revealed that the following functions
later on in freedynamicdata() were then adding more deleted
objects to the go.objs_deleted chain:
free_current_level();
freeobjchn(gi.invent);
freeobjchn(gm.migrating_objs);
Move the call to dobjsfree() to a location after those listed
above.
This commit is contained in:
@@ -1213,7 +1213,6 @@ freedynamicdata(void)
|
||||
|
||||
/* move-specific data */
|
||||
dmonsfree(); /* release dead monsters */
|
||||
dobjsfree();
|
||||
alloc_itermonarr(0U); /* a request of 0 releases existing allocation */
|
||||
|
||||
/* level-specific data */
|
||||
@@ -1226,6 +1225,8 @@ freedynamicdata(void)
|
||||
free_light_sources(RANGE_GLOBAL);
|
||||
freeobjchn(gi.invent);
|
||||
freeobjchn(gm.migrating_objs);
|
||||
if (go.objs_deleted)
|
||||
dobjsfree(); /* really free deleted objects */
|
||||
freemonchn(gm.migrating_mons);
|
||||
freemonchn(gm.mydogs); /* ascension or dungeon escape */
|
||||
/* freelevchn(); -- [folded into free_dungeons()] */
|
||||
|
||||
Reference in New Issue
Block a user