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

Function BF_do_malloc_small

BeefRT/dbg/gc.cpp:558–580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556}
557
558inline void* BF_do_malloc_small(ThreadCache* heap, size_t& size)
559{
560 if (size == 0)
561 size = (int)sizeof(void*);
562
563 ASSERT(Static::IsInited());
564 ASSERT(heap != NULL);
565 heap->requested_bytes_ += size;
566 size_t cl = Static::sizemap()->SizeClass(size);
567 size = Static::sizemap()->class_to_size(cl);
568
569 void* result;
570 if ((TCMALLOC_NAMESPACE::FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
571 result = DoSampledAllocation(size);
572 }
573 else {
574 // The common case, and also the simplest. This just pops the
575 // size-appropriate freelist, after replenishing it if it's empty.
576 result = CheckedMallocResult(heap->Allocate(size, cl));
577 }
578
579 return result;
580}
581
582void* BfObjectAllocate(intptr size, bf::System::Type* objType)
583{

Callers 1

BfObjectAllocateFunction · 0.70

Calls 6

DoSampledAllocationFunction · 0.50
CheckedMallocResultFunction · 0.50
SizeClassMethod · 0.45
class_to_sizeMethod · 0.45
SampleAllocationMethod · 0.45
AllocateMethod · 0.45

Tested by

no test coverage detected