[Gc] Marking memory as traceable

Christian Gudrian christian at gudrian.org
Tue Apr 20 00:34:20 PDT 2010


Hello!

I'm using the collector on Windows with Embarcadero RAD Studio 2010 and 
VCL applications.  The VCL framework classes' memory is not traced by 
the collector so whenever I put references to garbage collected memory 
into such a class, I wrap the references in a struct which then gets 
allocated by GC_malloc_uncollectable during construction and accordingly 
freed during destruction.

Since that's a bit too cumbersome for me I would like to tell the 
collector to trace a certain portion of memory for referenced object.  
Initially I thought that what's GC_add_roots for, on Windows, however, 
its counterpart GC_remove_roots is obviously not implemented.  Hence I 
would end up continually adding roots to the collector while being 
unable to remove those which have become invalid.

Should I stick to using my traceable struct or is there a better way?

Christian


More information about the Gc mailing list