A pointer to a valid memory address or to null.
The size in bytes of the block to add. If sz is zero then the no operation will occur. If p is null then sz must be zero.
TypeInfo to describe the memory. The GC might use this information to improve scanning for pointers or to call finalizers
// Allocate a piece of memory on the C heap. enum size = 1_000; auto rawMemory = core.stdc.stdlib.malloc(size); // Add it as a GC range. GC.addRange(rawMemory, size); // Now, pointers to GC-managed memory stored in // rawMemory will be recognized on collection.
Adds p[0 .. sz] to the list of memory ranges to be scanned for pointers during a collection. If p is null, no operation is performed.
Note that p[0 .. sz] is treated as an opaque range of memory assumed to be suitably managed by the caller. In particular, if p points into a GC-managed memory block, addRange does not mark this block as live.