Skip to main content

GC_register_displacement

Function GC_register_displacement 

Source
pub unsafe extern "C" fn GC_register_displacement(arg1: usize)
Expand description

Add a displacement to the set of those considered valid by the collector. GC_register_displacement(offset) means that if p was returned by GC_malloc(), then (char *)p + offset will be considered to be a valid pointer to p. offset must be less than the size of a heap block. (All pointers to the interior of objects from the stack are considered valid in any case. This applies to heap objects and static data.) Preferably, this should be called before any other GC procedures. Calling it later adds to the probability of excess memory retention. This is a no-op if the collector has recognition of arbitrary interior pointers enabled, which is the default (assuming the collector is built with ALL_INTERIOR_POINTERS macro defined). The debugging variant should be used if any debugging allocation is being done.