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

Function GC_generic_malloc_inner

v2/engine/boehm_gc/malloc.c:101–132  ·  view source on GitHub ↗

allocate lb bytes for an object of kind k. */ Should not be used to directly to allocate */ objects such as STUBBORN objects that */ require special handling on allocation. */ First a version that assumes we already */ hold lock: */

Source from the content-addressed store, hash-verified

99/* First a version that assumes we already */
100/* hold lock: */
101void * GC_generic_malloc_inner(size_t lb, int k)
102{
103 void *op;
104
105 if(SMALL_OBJ(lb)) {
106 struct obj_kind * kind = GC_obj_kinds + k;
107 size_t lg = GC_size_map[lb];
108 void ** opp = &(kind -> ok_freelist[lg]);
109
110 if( (op = *opp) == 0 ) {
111 if (GC_size_map[lb] == 0) {
112 if (!GC_is_initialized) GC_init_inner();
113 if (GC_size_map[lb] == 0) GC_extend_size_map(lb);
114 return(GC_generic_malloc_inner(lb, k));
115 }
116 if (kind -> ok_reclaim_list == 0) {
117 if (!GC_alloc_reclaim_list(kind)) goto out;
118 }
119 op = GC_allocobj(lg, k);
120 if (op == 0) goto out;
121 }
122 *opp = obj_link(op);
123 obj_link(op) = 0;
124 GC_bytes_allocd += GRANULES_TO_BYTES(lg);
125 } else {
126 op = (ptr_t)GC_alloc_large_and_clear(ADD_SLOP(lb), k, 0);
127 GC_bytes_allocd += lb;
128 }
129
130out:
131 return op;
132}
133
134/* Allocate a composite object of size n bytes. The caller guarantees */
135/* that pointers past the first page are not relevant. Caller holds */

Callers 5

GC_debug_gcj_mallocFunction · 0.85
GC_generic_mallocFunction · 0.85
GC_generic_malloc_manyFunction · 0.85

Calls 5

GC_init_innerFunction · 0.85
GC_extend_size_mapFunction · 0.85
GC_alloc_reclaim_listFunction · 0.85
GC_allocobjFunction · 0.85
GC_alloc_large_and_clearFunction · 0.85

Tested by

no test coverage detected