Now that mapping is done through a different code path, we can properly allocate large memory chunks on Windows

This commit is contained in:
Jeffrey Pfau 2014-07-16 02:20:29 -07:00
parent 0584c19229
commit 7bb5e29a98
1 changed files with 4 additions and 4 deletions

View File

@ -1,13 +1,13 @@
#include "util/memory.h" #include "util/memory.h"
#include <io.h>
#include <Windows.h> #include <Windows.h>
void* anonymousMemoryMap(size_t size) { void* anonymousMemoryMap(size_t size) {
HANDLE hMap = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size & 0xFFFFFFFF, 0); return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
return MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, size);
} }
void mappedMemoryFree(void* memory, size_t size) { 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);
} }