| 1650 | } |
| 1651 | |
| 1652 | static size_t LFGetSize(const void* p) { |
| 1653 | #if defined(LFALLOC_DBG) |
| 1654 | if (p == nullptr) |
| 1655 | return 0; |
| 1656 | return GetOrigAllocHeader(const_cast<void*>(p))->Size; |
| 1657 | #endif |
| 1658 | |
| 1659 | uintptr_t chkOffset = ((const char*)p - ALLOC_START); |
| 1660 | if (chkOffset >= N_MAX_WORKSET_SIZE) { |
| 1661 | if (p == nullptr) |
| 1662 | return 0; |
| 1663 | return TLargeBlk::As(p)->Pages * 4096ll; |
| 1664 | } |
| 1665 | uintptr_t chunk = ((const char*)p - ALLOC_START) / N_CHUNK_SIZE; |
| 1666 | ptrdiff_t nSizeIdx = chunkSizeIdx[chunk]; |
| 1667 | if (nSizeIdx <= 0) |
| 1668 | return TLargeBlk::As(p)->Pages * 4096ll; |
| 1669 | return nSizeIdxToSize[nSizeIdx]; |
| 1670 | } |
| 1671 | |
| 1672 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 1673 | // Output mem alloc stats |
no test coverage detected