Function core.gc.registry.registerGCFactory
Register a GC factory under the given name. This function must be called
from a C constructor before druntime is initialized.
void registerGCFactory(
string name,
core .gc .gcinterface .GC function() factory,
nothrow @nogc void function(ThreadBase) threadInit = null
) nothrow @nogc;
To use the registered GC, it's name must be specified gcopt runtime option, e.g. by passing , --DRT-gcopt=gc:my_gc_name as application argument.
The thread init function will be called *only before* the GC has been initialized to the registered GC. It is called as the first step in starting the new thread before the thread is registered with the runtime as a running thread. This allows any specific thread data that is needed for running the GC to be registered with the thread object.
After the GC is initialized, the GC interface function initThread is
called instead. This function should expect the possibility that the
reciprocal cleanupThread method may not be called if the GC is never
initialized.
Parameters
| Name | Description |
|---|---|
| name | name of the GC implementation; should be unique |
| factory | function to instantiate the implementation |
| threadInit | function to call from a new thread *before* registration in the list of running threads, to set up any GC-specific data. |
Note
The registry does not perform synchronization, as registration is assumed to be executed serially, as is the case for C constructors.
See Also
Authors
Martin Nowak