@@ -594,7 +594,7 @@ void *MapAllocator<Config>::allocate(const Options &Options, uptr Size,
594
594
ScopedLock L (Mutex);
595
595
InUseBlocks.push_back (H);
596
596
AllocatedBytes += H->CommitSize ;
597
- FragmentedBytes += reinterpret_cast <uptr>(H ) - H->CommitBase ;
597
+ FragmentedBytes += H-> MemMap . getCapacity ( ) - H->CommitSize ;
598
598
NumberOfAllocs++;
599
599
Stats.add (StatAllocated, H->CommitSize );
600
600
Stats.add (StatMapped, H->MemMap .getCapacity ());
@@ -668,7 +668,7 @@ void *MapAllocator<Config>::allocate(const Options &Options, uptr Size,
668
668
ScopedLock L (Mutex);
669
669
InUseBlocks.push_back (H);
670
670
AllocatedBytes += CommitSize;
671
- FragmentedBytes += reinterpret_cast <uptr>(H ) - H-> CommitBase ;
671
+ FragmentedBytes += H-> MemMap . getCapacity ( ) - CommitSize ;
672
672
if (LargestSize < CommitSize)
673
673
LargestSize = CommitSize;
674
674
NumberOfAllocs++;
@@ -687,7 +687,7 @@ void MapAllocator<Config>::deallocate(const Options &Options, void *Ptr)
687
687
ScopedLock L (Mutex);
688
688
InUseBlocks.remove (H);
689
689
FreedBytes += CommitSize;
690
- FragmentedBytes -= reinterpret_cast <uptr>(H ) - H-> CommitBase ;
690
+ FragmentedBytes -= H-> MemMap . getCapacity ( ) - CommitSize ;
691
691
NumberOfFrees++;
692
692
Stats.sub (StatAllocated, CommitSize);
693
693
Stats.sub (StatMapped, H->MemMap .getCapacity ());
0 commit comments