Function libmimalloc_sys::mi_register_deferred_free
source ยท pub unsafe extern "C" fn mi_register_deferred_free(
out: mi_deferred_free_fun,
arg: *mut c_void,
)
Expand description
Register a deferred free function.
deferred_free
Address of a deferred free-ing function orNone
to unregister.arg
Argument that will be passed on to the deferred free function.
Some runtime systems use deferred free-ing, for example when using reference counting to limit the worst case free time.
Such systems can register (re-entrant) deferred free function to free more memory on demand.
-
When the
force
parameter istrue
all possible memory should be freed. -
The per-thread
heartbeat
parameter is monotonically increasing and guaranteed to be deterministic if the program allocates deterministically. -
The
deferred_free
function is guaranteed to be called deterministically after some number of allocations (regardless of freeing or available free memory).
At most one deferred_free
function can be active.
Note: This function is thread safe.