MCPcopy Create free account
hub / github.com/boostorg/build / calloc

Function calloc

src/engine/boehm_gc/malloc.c:349–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347#endif
348
349void * calloc(size_t n, size_t lb)
350{
351# if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES)
352 /* libpthread allocated some memory that is only pointed to by */
353 /* mmapped thread stacks. Make sure it's not collectable. */
354 {
355 static GC_bool lib_bounds_set = FALSE;
356 ptr_t caller = (ptr_t)__builtin_return_address(0);
357 /* This test does not need to ensure memory visibility, since */
358 /* the bounds will be set when/if we create another thread. */
359 if (!lib_bounds_set) {
360 GC_init_lib_bounds();
361 lib_bounds_set = TRUE;
362 }
363 if (caller >= GC_libpthread_start && caller < GC_libpthread_end
364 || (caller >= GC_libld_start && caller < GC_libld_end))
365 return GC_malloc_uncollectable(n*lb);
366 /* The two ranges are actually usually adjacent, so there may */
367 /* be a way to speed this up. */
368 }
369# endif
370 return((void *)REDIRECT_MALLOC(n*lb));
371}
372
373#ifndef strdup
374# include <string.h>

Callers

nothing calls this directly

Calls 2

GC_init_lib_boundsFunction · 0.85
GC_malloc_uncollectableFunction · 0.85

Tested by

no test coverage detected