Skip to content

Instantly share code, notes, and snippets.

@andrew-d
Created November 12, 2013 20:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrew-d/7437982 to your computer and use it in GitHub Desktop.
Save andrew-d/7437982 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <windows.h>
int main(void) {
int ctr = 0;
int i;
for( i = 0; ; i++ ) {
void* ret = VirtualAllocEx(
GetCurrentProcess(),
NULL,
4 * 1024 * 1024,
MEM_RESERVE,
PAGE_READWRITE);
if( NULL == ret ) {
printf("error = %d\n", GetLastError());
break;
}
ctr++;
if( (ctr % 1000) == 0 ) {
printf("%d\n");
}
}
printf("%d\n", ctr);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment