Home Products Contracting Purchase About Contact
Home Products Contracting Purchase About Contact
VMem VMem


You can download and try VMem for free. For commercial usage you must
purchase a license.


The fastest way to try out VMem is to include VMem.cpp/h into your project, and then globally override new and delete to call the VMem Alloc and Free functions.

void* operator new(size_t size)
    return VMem::Alloc(size);

void operator delete(void* p)

void* operator new[](size_t size)
    return VMem::Alloc(size);

void operator delete[](void* p)

Please see the README.txt in the VMem download for detailed instructions on integrating VMem into your codebase.


24/05/2016Version: 3.1

Summary: Optimisation for free page insertion. Optimisation and improvement of double free check.

-optimised InsertPageInFreeList. Now searches from the last inserted node instead of the beginning.
-in FSA::CheckIntegrity check that the free list is properly sorted
-FSAHeaps now flush empty pages in service thread update. This makes the heap throw away empty pages sooner
-changed hard coded value of 4 to be sizeof(void*) in trail guard double free checking
-improved doiuble free checking. Instead of checking for the free emmory marker within the allocation we check the guard bytes at the end which shouoldn't have been overwritten. We also don't need to loop through the free list to double check that it is actually free.
-changed FSA free memset to memset the entire slot size including guard bytes
-enable FSA guards in debug level 2. They are very useful and only add a small amount of memory. Also needed for tracking down double frees.
-added Test_FSAFreeStress to stress test FSA allocators
-added CorePrivatePCH.h include when compiling with UE4
-updated iOS xcode project

07/03/2016Version: 3.0

Summary: Significant optimisations: caches for releasing memory, decommitting memory, empty FSA pages and the coalesce heap. These caches delay the memory going back to the system or heap and allow for fast re-alocation. A server thread runs in the background every 30ms clearing down allocations that have been in the cache for more than a specified time.

Other optimisations come from reducing false sharing, reducing contention, more inlining, more FSAs and faster heap lookup for allocations (virtually lock free).

-re-wrote BasicFSA to be more optimal. Now uses a simple free list and never frees allocs.
-fixes for clang compiler
-removed _WIN32_WINNT define if not defined
-optional alignment arg to Alloc function (can be freed with Free)
-renamed VMem.hpp to VMem.h (in single file version)
-proper handling of out of memory situations. VMem will now always return NULL if no memory is available and will keep itself in an internally valid state. Also allows for failures in iniitalising the heap.
-fixed stats bug in BasicCoalesceHeap for internal allocations that are larger than 16K. Unlikely to ever happen in practice, but uncovered by test framework.
-changed VMEM_STATIC_ASSERT to use C++ static_assert
-Coalesce heap cache. Free list per size before alloc gets put back onto the heap. Reduced contention with lock per size.
-optimised GetSize. Now completely lock free in the case where the heaps have one region and reduced cache misses
-restrict keyword optimisations
-simplified code by removing single thread support and merged MT classes into main heap classes
-FSA empty page cache. Empty pages get put onto a cache before being released to avoid the page setup cost if the page is needed again.
-inlining of FSA Alloc and Free functions
-added buffers to critical code to avoid false-sharing
-FSA heaps now handle allocations of a larger size
-increased region sizes to avoid multiple regions being created
-changed some of the critical sections over to read/write locks (eliminates locks in multi-read case)
-remove all locks for finding the heap that an allocation originated from
-added PhysicalHeap for GPU allocations (not yet integrated into VMemAlloc)
-added service thread for clearing down caches
-added virtual commit and release caches. Memory is not decommitted or released immediately allowing for fast re-use
-improved allocation recording for playback profiles
-realloc will now only realloc if new size outside tolerance
-In an out of memory situation all cached are flushed immediately and the alloc retried
-Unix-based systems now use mmap/munmap to commit and decommit emmory (equivalent to virtual alloc)
-added VMEM_PLATFORM_PS4 platform define (for future suport of PS4)
-allow for 5% slack wastage of FSA sizes which allocs for many more FSAs
-changed HeapSettings to an enum to avoid unnecessary cache misses
-Simplified code by factoring out Array, List and Map classes
-vcproj now uses v140 toolset (VS2015)

07/04/2015Version: 2.4

Summary:Support for compiling with Unreal. Namespace fixes. XBoxOne support. Minor bug fix in CoalesceHeap.

-support for compiling within Unreal
-VMem is now entirely compiled out if ENABLE_VMEM is not defined
-everything is now inside of VMem namespace without using any using statements. This fixes issues with Unreal unity builds
-fixed edge case assert BasicCoalesceHeap would fail if tried to allocate allocations more than the region size.
-changed inlines to __forceinline
-fixed bug in UpdateLargestFreeNodeSize in CoalesceHeap. This would cause a slight inefficiency because the largest free block would not always be used
-added extra asserts for catching memory corruptions
-fixed compile warning in FSA.cpp related to memset
-assert to ensure that LargeHeap allocations align to the system page size
-more support for gracefully handling out of memory situations
-fixed the allocation index in the protected heap and made it start off at a random value
-replaced VMEM_UNREFERENCED_PARAM(p) in macros with ((void)0) to make sure p definitely isn't evaluated
-added support for XBoxOne platform
-smaller protected heap sizes for xbxoone and x86
-changed settings values to size_t to avoid a cast in VMem::Alloc
-added critical section to VMem Reserve/commit functions to keep the global stats in sync
-added unit test to check for the largest free size coalesce heap bug

15/06/2014Version: 2.3.1

Summary:Minor update. Fixed compile warnings, and fixed stats assert in debug level 4

-additional test configutations
-fixed compile warning in CoalesceHeap for x64 config
-fixed compile warnings in ProtectedHeap for x64 config
-fixed committed memory stat wen protected heap runs out of memory and has to retry (caused an assert in debug level 4)
-fixed Test_MemoryCorruptionFinderTest3 test.

20/04/2014Version: 2.3

Summary:Aligned alloc functions, CoalesceHeap optimisation, UE4 integration. Improvements to corruption finder.

-for non windows platforms changed CoalesceHeap1 size from 128K to 4MB. This was a major slowdown on non windows platforms because it caused many regions to be created.
-updated README files
-added Debug and Debug4 large page test configurations
-updated copyright notice
-removed NoReleaseBitfield for the corruption finder. Now uses a bitfield for committed pages
-optimised CoalesceHeap::GetNode for the cases where there are many regions
-changed Min and Max functions to VMem::VMin/VMem::VMax to avoid conflicts with codebases that define Min/Max globally
-added a warning if there are more than 10 coalesce heap regions
-changed the way that PageHeap corruption finder works. Now uses seperate bitfield to remember which pages are committed. Fixes the stats assert.
-fixed asserts where stats don't match up if the PageHeap runs out of memory
-re-enabled alternate pages in PageHeap when the corruption finder is enabled
-made the VirtualMem Node pool use SYS_PAGE_SIZE instead of 4K to avoid wasting memory if the system page size is larger than 4K
-added some notes to VMemAlloc.hpp about general usage of VMem
-added Aligned alloc/free functions
-removed VMemCore.hpp include from VMemAlloc.hpp and replaced with VMemStats.hpp. This pulls in less code into the main header.
-fixed some compile settings in some of the configs
-enabled corruption finder for all windows based platforms
-Only define SYS_PAGE_SIZE if the config has not already defined it
-removed m_TableAllocSize from VMemHashMap because it wasn't being used
-changed VMemHashMap default allocation size from 4K to SYS_PAGE_SIZE
-changes warning to assert if VMemHeap::Free fails to find allocation
-fixed compile error when using protected heap
-fixed compile errors for XBOX360 platform
-added instruction for UE4 integration

20/04/20142.2 - Debug Level 4 - Page Protection
-added Debug level 4
-fixed compile error when VMEM_DELAYED_RELEASE is disabled
-typedef'd log function
-added DISABLE_BIASING define
-fixed usage_percent in stats if allocated bytes is zero (now shows 100%)
-VMem_Test tests that check access violations on Debug level 4
-changed RandomGrowth in VMem_Test to have a lower phase. Exercises allocators more.
-gave VMem_Test it's own thread class to separate it from VMem
-compile fixes for Android
-added NoReleaseBitfield - used in PageHeap
-disabled PageHeap alternate pages
-coalesce heap stores list of protected nodes
-ProtectedHeap class
- added g_VMemSHouldProtectFn for custom choose protect function
-in VMemHeap::Alloc, try the protected heap first.
-in VMemHeap::Alloc if runs out of memory, clear some protected memory and retry

23/01/20142.1.1 - More improvements to integrity checking.
-Fixed FSA integrity checking, wasn't checking memory when page was released.

Full change log...