Custom Memory Allocator – Arma 2
Jump to navigation
Jump to search
Line 19: | Line 19: | ||
Total memory committed by the allocator (should correspond to VirtualAlloc with MEM_COMMIT) | Total memory committed by the allocator (should correspond to VirtualAlloc with MEM_COMMIT) | ||
=== MemTotalReserved() === | === MemTotalReserved() === | ||
Total memory reserved by the allocator (should correspond to VirtualAlloc with MEM_RESERVE) | |||
=== MemFlushCache(size_t size) === | === MemFlushCache(size_t size) === | ||
=== MemFlushCacheAll() === | === MemFlushCacheAll() === |
Revision as of 12:44, 27 October 2011
Since Arma 2 Operation Arrowhead build 85869 (1.60 beta) it is possible to provide custom memory allocators for the game. The allocator is a dll placed in dll directory located next to the game executable.
The dll interface is as follows:
extern "C" { __declspec(dllexport) size_t __stdcall MemTotalCommitted(); // _MemTotalCommitted@0 __declspec(dllexport) size_t __stdcall MemTotalReserved(); // _MemTotalReserved@0 __declspec(dllexport) size_t __stdcall MemFlushCache(size_t size); // _MemFlushCache@4 __declspec(dllexport) void __stdcall MemFlushCacheAll(); // _MemFlushCacheAll@0 __declspec(dllexport) size_t __stdcall MemSize(void *mem); // _MemSize@4 __declspec(dllexport) void *__stdcall MemAlloc(size_t size); // _MemAlloc@4 __declspec(dllexport) void __stdcall MemFree(void *mem); // _MemFree@4 };
MemTotalCommitted()
Total memory committed by the allocator (should correspond to VirtualAlloc with MEM_COMMIT)
MemTotalReserved()
Total memory reserved by the allocator (should correspond to VirtualAlloc with MEM_RESERVE)