MCPcopy Create free account
hub / github.com/beefytech/Beef / BF_do_malloc_pages

Function BF_do_malloc_pages

BeefRT/dbg/gc.cpp:529–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527}
528
529inline void* BF_do_malloc_pages(ThreadCache* heap, size_t& size)
530{
531 void* result;
532 bool report_large;
533
534 heap->requested_bytes_ += size;
535 Length num_pages = TCMALLOC_NAMESPACE::pages(size);
536 size = num_pages << kPageShift;
537
538 if ((TCMALLOC_NAMESPACE::FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
539 result = DoSampledAllocation(size);
540
541 SpinLockHolder h(Static::pageheap_lock());
542 report_large = should_report_large(num_pages);
543 }
544 else {
545 SpinLockHolder h(Static::pageheap_lock());
546 Span* span = Static::pageheap()->New(num_pages);
547 result = (UNLIKELY(span == NULL) ? NULL : SpanToMallocResult(span));
548 report_large = should_report_large(num_pages);
549 }
550
551 if (report_large) {
552 ReportLargeAlloc(num_pages, result);
553 }
554
555 return result;
556}
557
558inline void* BF_do_malloc_small(ThreadCache* heap, size_t& size)
559{

Callers 1

BfObjectAllocateFunction · 0.70

Calls 7

pagesFunction · 0.50
DoSampledAllocationFunction · 0.50
should_report_largeFunction · 0.50
SpanToMallocResultFunction · 0.50
ReportLargeAllocFunction · 0.50
SampleAllocationMethod · 0.45
NewMethod · 0.45

Tested by

no test coverage detected