Now that mapping is done through a different code path, we can properly allocate large memory chunks on Windows
Jeffrey Pfau jeffrey@endrift.com
Wed, 16 Jul 2014 02:20:29 -0700
1 files changed,
4 insertions(+),
4 deletions(-)
jump to
M
src/platform/windows/memory.c
→
src/platform/windows/memory.c
@@ -1,13 +1,13 @@
#include "util/memory.h" -#include <io.h> #include <Windows.h> void* anonymousMemoryMap(size_t size) { - HANDLE hMap = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size & 0xFFFFFFFF, 0); - return MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, size); + return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); } void mappedMemoryFree(void* memory, size_t size) { - // TODO fill in + UNUSED(size); + // size is not useful here because we're freeing the memory, not decommitting it + VirtualFree(memory, 0, MEM_RELEASE); }