MCPcopy Create free account
hub / github.com/devosoft/avida / do_malloc

Function do_malloc

libs/tcmalloc-1.4/src/tcmalloc.cc:601–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601inline void* do_malloc(size_t size) {
602 void* ret = NULL;
603
604 // The following call forces module initialization
605 ThreadCache* heap = ThreadCache::GetCache();
606 if (size <= kMaxSize) {
607 // The common case, and also the simplest. This just pops the
608 // size-appropriate freelist, after replenishing it if it's empty.
609 ret = CheckedMallocResult(heap->Allocate(size));
610 } else {
611 ret = do_malloc_pages(tcmalloc::pages(size));
612 }
613 if (ret == NULL) errno = ENOMEM;
614 return ret;
615}
616
617inline void* do_calloc(size_t n, size_t elem_size) {
618 // Overflow check

Callers 6

do_callocFunction · 0.85
do_realloc_with_callbackFunction · 0.85
cpp_allocFunction · 0.85
MarkThreadBusyMethod · 0.85
tc_mallocFunction · 0.85
tc_reallocFunction · 0.85

Calls 4

CheckedMallocResultFunction · 0.85
do_malloc_pagesFunction · 0.85
pagesFunction · 0.85
AllocateMethod · 0.80

Tested by

no test coverage detected