This commit is contained in:
Araq 2017-01-30 19:01:03 +01:00
commit b26e6e3589
3 changed files with 68 additions and 44 deletions

View file

@ -132,7 +132,7 @@ elif defined(windows):
header: "<windows.h>", stdcall, importc: "VirtualAlloc".}
proc virtualFree(lpAddress: pointer, dwSize: int,
dwFreeType: int32) {.header: "<windows.h>", stdcall,
dwFreeType: int32): cint {.header: "<windows.h>", stdcall,
importc: "VirtualFree".}
proc osAllocPages(size: int): pointer {.inline.} =
@ -151,7 +151,10 @@ elif defined(windows):
# Windows :-(. We have to live with MEM_DECOMMIT instead.
# Well that used to be the case but MEM_DECOMMIT fragments the address
# space heavily, so we now treat Windows as a strange unmap target.
when reallyOsDealloc: virtualFree(p, 0, MEM_RELEASE)
when reallyOsDealloc:
if virtualFree(p, 0, MEM_RELEASE) == 0:
cprintf "yes, failing!"
quit 1
#VirtualFree(p, size, MEM_DECOMMIT)
elif hostOS == "standalone":