Skip to content

Instantly share code, notes, and snippets.

@basavesh
Created April 16, 2014 07:54
Show Gist options
  • Save basavesh/10827567 to your computer and use it in GitHub Desktop.
Save basavesh/10827567 to your computer and use it in GitHub Desktop.
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int i =0;
char *memPtr=NULL;
char *memPtr2G=NULL;
int j=0;
int ulResult=0;
while(1)
{
for(i=0;i<1000000;i++)
{
memPtr=malloc(1024);
memset(memPtr,0,1024);
free(memPtr) ;
if(memPtr2G!=NULL)
{
memset(memPtr2G,i,2*1024*1024*1024);
}
j=j+i;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment