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

Function init

db/memdebug.c:358–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358static void init() {
359 static int once = 1;
360 if (once) {
361 once = 0;
362 pthread_mutexattr_t mattr;
363 pthread_mutexattr_init(&mattr);
364 pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
365 Pthread_mutex_init(&lk, &mattr);
366 Pthread_key_create(&threadk, thread_done);
367 calls = hash_setalloc_init_user(call_hashfunc, call_cmpfunc, dl_malloc, dl_free, 0, sizeof(int));
368 listc_init(&blocks, offsetof(struct memblock, alnk));
369 init_symtab();
370 in_init = 0;
371 /* if the debug variable is not set, the malloc/etc. code continues to call real malloc */
372
373 memdebug_out = fopen("memdebug.out", "w");
374 setbuf(memdebug_out, NULL);
375
376 atexit(dump_callers_at_exit);
377 }
378}
379
380void *malloc(size_t size) {
381 struct call *c;

Callers 5

mallocFunction · 0.70
callocFunction · 0.70
freeFunction · 0.70
reallocFunction · 0.70
strdupFunction · 0.70

Calls 3

hash_setalloc_init_userFunction · 0.85
listc_initFunction · 0.85
init_symtabFunction · 0.85

Tested by

no test coverage detected