[D-runtime] DLL initialization in Druntime

Sean Kelly sean at invisibleduck.org
Mon Jan 17 10:36:49 PST 2011


On Jan 16, 2011, at 9:54 AM, Rainer Schuetze wrote:

> Hi,
> 
> I have not updated to the latest version yet, but it seems that it's the first time that gc_addRange is called during initialization, and this hits the bug in the gc stub code (obviously, the return statements are missing for the "proxy is null" case).
> 
> Even if fixed, the proxy has the problem that anything that has been allocated until the proxy is switched, uses a different heap, because the C-Runtime is not shared between the DLLs. This will cause problems when trying to scan/collect objects.

Allocating memory from the GC before initializing the runtime results in undefined behavior.  If you're using gcstub though, the only thing that won't work is that allocated blocks won't be scanned for roots by the new GC, but this behavior isn't expected anyway.  The new GC doesn't own the memory allocated by the old GC.  Also, The roots and ranges are already transferred to the new GC. (see gc_setProxy), so the static data segment of the DLL will be scanned by the app's GC.


More information about the D-runtime mailing list