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

Function BF_do_malloc_pages

BeefRT/dbg/gc_raw.cpp:481–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481 inline void* BF_do_malloc_pages(ThreadCache* heap, size_t& size)
482 {
483 void* result;
484 bool report_large;
485
486 heap->requested_bytes_ += size;
487 Length num_pages = TCMALLOC_NAMESPACE::pages(size);
488 size = num_pages << kPageShift;
489
490 if ((TCMALLOC_NAMESPACE::FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
491 result = DoSampledAllocation(size);
492
493 SpinLockHolder h(Static::pageheap_lock());
494 report_large = should_report_large(num_pages);
495 }
496 else {
497 SpinLockHolder h(Static::pageheap_lock());
498 Span* span = Static::pageheap()->New(num_pages);
499 result = (UNLIKELY(span == NULL) ? NULL : SpanToMallocResult(span));
500 report_large = should_report_large(num_pages);
501 }
502
503 if (report_large) {
504 ReportLargeAlloc(num_pages, result);
505 }
506
507 return result;
508 }
509
510 inline void* BF_do_malloc_small(ThreadCache* heap, size_t& size)
511 {

Callers 1

BfRawAllocateFunction · 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