Home Products Contracting Purchase Resellers About Contact
Home Products Contracting Purchase Resellers About Blog Contact
VMem VMem

Download

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

Setup

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)
{
    VMem::Free(p);
}

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

void operator delete[](void* p)
{
    VMem::Free(p);
}

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



Changes



01/06/2017Version: 3.2

Summary: Support for Platstation 4. Support for multiple heaps. Physical heaps, thread heaps. Some minor optimisations and fixes for OOM edge cases.

-Support for PS4
-All define now start with VMEM_
-Renamed the following defines: ENABLE_VMEM => VMEM_ENABLE, VMEM_STATS => VMEM_ENABLE_STATS, VMEMSET => VMEM_MEMSET, VSTATS => VMEM_STATS, VMEM64_ONLY => VMEM_X64_ONLY, VMEMHEAP_GLOBAL_LOCK => VMEM_HEAP_GLOBAL_LOCK
-removed unused LARGE_ALLOC_NODE_MARKER define
-VMem recordings now reocrd alignment
-fixed compile errors for VMem_Test on Linux
-clang projects on windows updated to v140_clang_c2 toolset
-fixed bug in checking of log for memory corrruption string in VMem_Test
-fixed global initialisation order bug with simulate OOM variables
-Creation of physical heaps from the main VMem interface: VMem::CreatePhysicalHeap
-Support for heaps backed with GPU memory
-Bug fixes for edge case OOM situations
-fixed potential spurious wake-ups of service thread on Unix systems
-ensure that ThreadGlobalData and VMemSysData are aligned to 8 bytes. Caused problems with critical section on some unix platforms
-moved VMEM_SIMULATE_OOM define to Core.hpp
-added PhysicalPageMapper to deal with the mapping between physical and virtual pages (used for PS4)
-Fixed compile error if disabling the FSA cache in release (only call FASHeap Update if using the FSA page cache)
-Support for multiple custom heaps
-Support for multiple custom aligned heaps
-support for multiple physical heaps from the main interface
-support for thraed heaps. Create a heap for a single thread??
-moved VirtualMem stats out of VMemHeap and into VMemAlloc (because VirtualMem is shared by all heaps)
-moved stats writing out of VMemHeap and into VMemAlloc to support multiple heaps
-disable caches on systems which don't support atomics
-fixed compile error on older version of windows without analysis support
-fixed leak of region memory if hitting out of memory when allocating in coalesce heap
-fixed bug in VMemHashMap where if it failed to allocate due to an out of memory situation it would have become invalidated
-Optimisation: replaced linear VMemMap in DecommitNodeMap with RedBlackTree Map
-VirtualMem::TryCommit no longer fails due to out of memory when allocating offcut range
-fixed protected heap releasing of unreleased pages
-fixed bug in calloc override on an out of memory situation


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
-removed VMEM_DELAYED_RELEASE
-changed MEMPRO_PLATFORM_XBOX360 to VMEM_PLATFORM_XBOX360
-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
-changed MEMPRO_PLATFORM_GAMES_CONSOLE_1 define to MEMPRO_PLATFORM_XBOX360 and MEMPRO_PLATFORM_GAMES_CONSOLE_2 define to MEMPRO_PLATFORM_XBOXONE
-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%)
-changed VMEM_RESERVE check to VMEM_PLATFORM_WIN
-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
-
-ifdef VMEM_MEMORY_CORRUPTION_FINDER
-added NoReleaseBitfield - used in PageHeap
-disabled PageHeap alternate pages
-coalesce heap stores list of protected nodes
-disable VMEM_TRAIL_GUARDS, VMEM_DISABLE_BIASING, VMEM_DELAYED_RELEASE
-??
-ifdef VMEM_PROTECTED_HEAP
-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...