all repos — mgba @ 7bb5e29a984c2d509b072eafddc78ec712426c5a

mGBA Game Boy Advance Emulator

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
commit

7bb5e29a984c2d509b072eafddc78ec712426c5a

parent

0584c19229d9db6347422bdc55af3262de296e0a

1 files changed, 4 insertions(+), 4 deletions(-)

jump to
M src/platform/windows/memory.csrc/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); }