MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_arena_alloc

Function cbm_arena_alloc

src/foundation/arena.c:58–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void *cbm_arena_alloc(CBMArena *a, size_t n) {
59 if (!a || n == 0) {
60 return NULL;
61 }
62 /* 8-byte alignment */
63 n = (n + ARENA_ALIGN) & ~(size_t)ARENA_ALIGN;
64 if (a->nblocks == 0) {
65 return NULL;
66 }
67 if (a->used + n > a->block_size) {
68 if (!arena_grow(a, n)) {
69 return NULL;
70 }
71 }
72 char *ptr = a->blocks[a->nblocks - SKIP_ONE] + a->used;
73 a->used += n;
74 a->total_alloc += n;
75 return ptr;
76}
77
78void *cbm_arena_calloc(CBMArena *a, size_t n) {
79 void *p = cbm_arena_alloc(a, n);

Callers 15

cbm_path_joinFunction · 0.70
cbm_str_tolowerFunction · 0.70
cbm_str_replace_charFunction · 0.70
cbm_str_splitFunction · 0.70
cbm_arena_callocFunction · 0.70
cbm_arena_strdupFunction · 0.70
cbm_arena_strndupFunction · 0.70
cbm_arena_sprintfFunction · 0.70
run_extract_resolveFunction · 0.50
run_closure_deltaFunction · 0.50
extract_workerFunction · 0.50

Calls 1

arena_growFunction · 0.70

Tested by

no test coverage detected