[Gc] GC_use_DllMain and main thread registration

Christian Gudrian christian at gudrian.org
Wed Oct 20 02:21:15 PDT 2010


Hello!

I just tried to use the collector with DllMain based thread registration 
and found a catch during the startup phase of our program. Since I'm 
using the collector as a replacement for the standard memory manager the 
first allocations occur before I even have the chance to call 
GC_use_DllMain. Subsequently GC_thr_init registers the main thread in 
the table that is used for non-DllMain based registration. Once 
GC_use_DllMain has been called collection from the main thread fails as 
it cannot be found in the now relevant other thread table.

Is it safe to call GC_use_DllMain at the beginning of the collector's 
DllMain function in case of a process attaching?

Christian


More information about the Gc mailing list