plasma-umass / Mesh

A memory allocator that automatically reduces the memory footprint of C/C++ applications.
Apache License 2.0
1.75k stars 73 forks source link

Fix definition of MiniHeap::bytesFree #106

Closed aneeshdurg closed 6 months ago

aneeshdurg commented 9 months ago

Previously MiniHeap::bytesFree was reporting the bytes allocated, not the bytes free. This was impacting GlobalHeap::allocSmallMiniheaps which was always seeing bytesFree() return 0, and thus was always allocating the maximum number of MiniHeaps instead of stopping at bytesFree >= kMiniheapRefillGoalSize