MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / malloc

Function malloc

db/memdebug.c:380–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380void *malloc(size_t size) {
381 struct call *c;
382 struct memblock *b;
383 struct thread_info *ti;
384
385 init();
386 if (in_init)
387 return dl_malloc(size);
388
389 ti = get_thread_info();
390
391 b = dl_malloc(offsetof(struct memblock, mem) + size);
392 b->blocksize = size;
393 b->flags = 0;
394 b->ti = ti;
395 LOCK(&lk) {
396 c = get_call();
397 b->place_allocated = c;
398 c->total_allocated += size;
399 listc_abl(&c->blocks, b);
400 listc_abl(&blocks, b);
401 listc_abl(&ti->blocks, b);
402 } UNLOCK(&lk);
403 return b->mem;
404}
405
406void *calloc(size_t nelem, size_t elsize) {
407 struct call *c;

Callers 15

get_valFunction · 0.85
load_readline_historyFunction · 0.85
txn_retrieveFunction · 0.85
dump_subFunction · 0.85
dumpFunction · 0.85
loadFunction · 0.85
rheaderFunction · 0.85
convprintableFunction · 0.85
do_bindingsFunction · 0.85
cache_portFunction · 0.85

Calls 5

dl_mallocFunction · 0.85
get_callFunction · 0.85
listc_ablFunction · 0.85
initFunction · 0.70
get_thread_infoFunction · 0.70

Tested by 15

regmatch_to_numFunction · 0.68
regmatch_to_strFunction · 0.68
mainFunction · 0.68
test_decode_intFunction · 0.68
checkValueFunction · 0.68
mainFunction · 0.68
test_02Function · 0.68
test_04Function · 0.68
test_bind_arrayFunction · 0.68
get_valFunction · 0.68
load_readline_historyFunction · 0.68