STATIC void * GC_debug_generic_malloc(size_t lb, int knd, GC_EXTRA_PARAMS) { void * result = GC_generic_malloc(SIZET_SAT_ADD(lb, DEBUG_BYTES), knd); return store_debug_info(result, lb, "GC_debug_generic_malloc", OPT_RA s, i); }
GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_atomic(SIZET_SAT_ADD(lb, DEBUG_BYTES)); return store_debug_info(result, lb, "GC_debug_malloc_atomic", OPT_RA s, i); }
GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_uncollectable(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_uncollectable( SIZET_SAT_ADD(lb, UNCOLLECTABLE_DEBUG_BYTES)); return store_debug_info(result, lb, "GC_debug_malloc_uncollectable", OPT_RA s, i); }
GC_API GC_ATTR_MALLOC void * GC_CALL GC_finalized_malloc(size_t lb, const struct GC_finalizer_closure *fclos) { word *op; GC_ASSERT(done_init); op = GC_malloc_kind(SIZET_SAT_ADD(lb, sizeof(word)), GC_finalized_kind); if (EXPECT(NULL == op, FALSE)) return NULL; *op = (word)fclos | FINALIZER_CLOSURE_FLAG; return op + 1; }
GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS) { void * result; /* Note that according to malloc() specification, if size is 0 then */ /* malloc() returns either NULL, or a unique pointer value that can */ /* later be successfully passed to free(). We always do the latter. */ result = GC_malloc(SIZET_SAT_ADD(lb, DEBUG_BYTES)); # ifdef GC_ADD_CALLER if (s == NULL) { GC_caller_func_offset(ra, &s, &i); } # endif return store_debug_info(result, lb, "GC_debug_malloc", OPT_RA s, i); }
/* case, we need to make sure that all objects have debug headers. */ GC_INNER void * GC_debug_generic_malloc_inner(size_t lb, int k) { void * result; GC_ASSERT(I_HOLD_LOCK()); result = GC_generic_malloc_inner(SIZET_SAT_ADD(lb, DEBUG_BYTES), k); if (NULL == result) { GC_err_printf("GC internal allocation (%lu bytes) returning NULL\n", (unsigned long) lb); return(0); } if (!GC_debugging_started) { GC_start_debugging_inner(); } ADD_CALL_CHAIN(result, GC_RETURN_ADDR); return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", 0)); }