gc_term() memory leaking.

Neal Alexander wqeqweuqy at hotmail.com
Sun Jul 8 20:18:19 PDT 2007


Paul Findlay wrote:
>> Is there any way to force a GC instance in a DLL to free the heap pages
>> allocated by gc_init? gc_term()is just an alias to fullCollectNoStack().
> Tango's gc_term() call's a destructor which frees the calloc'ed heap.
> 
> But sorry, I don't know much more than that..
> 
>  - Paul

Alright, well i added this to src/phobos/internal/gc.d and rebuilt phobos.lib.

extern (C) void gc_destroy(){ _gc.Dtor(); }


And added gc_destroy() to the unload section of DllMain.


Looks like it solved the problem somewhat - it only leaks 100kb now when the DLL 
reloads instead of 1.5mb. That 100kb could easily be the fault of my program 
too; i'm not sure atm.


Should i file a bug report about this or what? Its possible gc_term()'s behavior 
has been the same ever since the start.

I'm using DMD2.02 if i haven't mentioned it already.


More information about the Digitalmars-d-learn mailing list