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

Function GC_malloc

v2/engine/boehm_gc/malloc.c:258–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256 void * GC_core_malloc(size_t lb)
257#else
258 void * GC_malloc(size_t lb)
259#endif
260{
261 void *op;
262 void **opp;
263 size_t lg;
264 DCL_LOCK_STATE;
265
266 if(SMALL_OBJ(lb)) {
267 lg = GC_size_map[lb];
268 opp = (void **)&(GC_objfreelist[lg]);
269 LOCK();
270 if( EXPECT((op = *opp) == 0, 0) ) {
271 UNLOCK();
272 return(GENERAL_MALLOC((word)lb, NORMAL));
273 }
274 /* See above comment on signals. */
275 GC_ASSERT(0 == obj_link(op)
276 || (word)obj_link(op)
277 <= (word)GC_greatest_plausible_heap_addr
278 && (word)obj_link(op)
279 >= (word)GC_least_plausible_heap_addr);
280 *opp = obj_link(op);
281 obj_link(op) = 0;
282 GC_bytes_allocd += GRANULES_TO_BYTES(lg);
283 UNLOCK();
284 return op;
285 } else {
286 return(GENERAL_MALLOC(lb, NORMAL));
287 }
288}
289
290# ifdef REDIRECT_MALLOC
291

Callers 14

GC_debug_mallocFunction · 0.70
GC_make_closureFunction · 0.70
GC_malloc_stubbornFunction · 0.70
GC_reallocFunction · 0.70
GC_memalignFunction · 0.70
GC_AllocProcFunction · 0.70
test.cFile · 0.50
mainFunction · 0.50

Calls

no outgoing calls

Tested by 1

mainFunction · 0.40