| 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 | { |
no test coverage detected