Platforms: Windows x86, x64, Unix, Linux, OSX, iOS
VMem - Fast and efficient
C++ malloc replacement
Integrate VMem with your code-base by adding one file and 2 lines of code.
Use the same allocator across multiple platforms ensuring that performance is consistent.
Whilst most allocators are thread safe, they are not necessarily designed with threads in mind. VMem is designed from the ground up to perform well in a multi-threaded setting. This is achieved using seperate locks for each small allocation size, and multiple tiers of locks per allocator. This ensures that there is a low probability of contention for each individual allocation.
Most allocators pre-allocate large blocks of memory from the system and then divide this up to service allocations. VMem only reserves the memory ranges, and commits the pages as necessary *. As soon as a page in a range is unused, VMem will release that page back to the system. This means that VMem will only commit the minimum amount of memory that it needs to at any one time. This also means that all heaps automatically resize themselves, leading to very little wastage.
* only applies to platforms that support decommitting memory back to the reserved state
Fragmentation is a very big problem, especially on systems without virtual memory. Any application running for a long period of time will fragment memory. The standard accepted loss to fragmentation is 10%; however, many allocators do not stabilise. VMem will stabilise at around 10% or lower. It achieves this using a feature called biasing. Read more about biasing in the technical documentation.
Memory corruptions are one of the hardest bugs to track down. VMem has many debug features and five re-defined debug levels. VMem utilises memory guards, background integrity checking, page protection and trail guards. At the highest debug level, VMem will check everything that it possibly can to ensure that memory corruptions are caught as soon as possible.
Unlike many older memory managers, which were written to be backwards-compatible with C, VMem is highly modular, clearly written and well commented. This allows you to easily debug and fix problems.
VMem tracks every byte that it allocates and produces detailed statistics on each heap. It shows the amount of used, unused, overhead and reserved memory for each heap, along with a percentage used value for a quick view of how optimally it is running.