| 556 | } |
| 557 | |
| 558 | inline 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 | |
| 582 | void* BfObjectAllocate(intptr size, bf::System::Type* objType) |
| 583 | { |
no test coverage detected