| 527 | } |
| 528 | |
| 529 | inline 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 | |
| 558 | inline void* BF_do_malloc_small(ThreadCache* heap, size_t& size) |
| 559 | { |
no test coverage detected