Created
October 30, 2014 02:19
-
-
Save 23Skidoo/ae5cedb5e4717e96de3d to your computer and use it in GitHub Desktop.
MEM_RESERVE gobs of memory on Windows happens instantly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* See https://ghc.haskell.org/trac/ghc/ticket/9706 */ | |
#include <windows.h> | |
#include <stdio.h> | |
int main() { | |
printf("How many GB to reserve:"); | |
SIZE_T numGB = 1; | |
scanf("%Iu", &numGB); | |
SIZE_T toReserve = numGB*1024*1024*1024; | |
printf("Trying to reserve %Iu bytes...\n", toReserve); | |
LPVOID addr = VirtualAlloc(NULL, toReserve, MEM_RESERVE, PAGE_NOACCESS); | |
printf("Got addr: %p\nPress any key...\n", addr); | |
getc(stdin); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment