Re: [Gc] GC_use_DllMain and main thread registration

Ivan Maidanski ivmai at
Wed Oct 20 12:20:54 PDT 2010


I think the alternative to call GC_use_DllMain() is to compile GC with some macro defined which defines GC_win32_dll_threads (as a macro) to TRUE (like I did on Darwin - see DARWIN_QUERY_TASK_THREADS macro). I'm going to add that macro for Win32 in a week.

Wed, 20 Oct 2010 11:21:15 +0200 Christian Gudrian <christian at>:

> 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