pub unsafe extern "C" fn GC_debug_malloc_replacement(
arg1: usize,
) -> *mut c_voidExpand description
The functions that allocate objects with debug information (like the
above), but just fill in dummy file and line number information.
Thus they can serve as drop-in malloc/realloc/reallocf replacements.
This can be useful for two reasons:
- It allows the collector to be built with
DBG_HDRS_ALLmacro defined even if some allocation calls come from 3rd-party libraries that cannot be recompiled. - On some platforms, the file and line information is redundant,
since it can be reconstructed from a stack trace. On such
platforms it may be more convenient not to recompile, e.g. for
leak detection. This can be accomplished by instructing the
linker to replace
malloc/realloc/reallocfwith these.
Note that these functions (for a nonzero new size in case of realloc
and reallocf) are guaranteed never to return NULL unless GC_oom_fn()
returns NULL.