Created
May 11, 2016 21:12
-
-
Save Juma7C9/84553d367bb6175a6fadbb0198a45412 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* Simple program to test memory allocation - goes on until killed */ | |
#include "stdlib.h" | |
#include "stdio.h" | |
#define _256M 64*1024*1024 | |
int* p; | |
int i=0, j; | |
int main(){ | |
do{ | |
p=malloc(_256M*sizeof(int)); | |
for(j=0; j<_256M; j++){ | |
*(p+j) = i+j; | |
} | |
printf("allocated %d MiB\n", i+=256); | |
} while ( p!= NULL ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment