Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 22nd, 2011  |  syntax: C  |  size: 0.30 KB  |  views: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <unistd.h>
  2.  
  3. void *malloc(int size) {
  4.         write(2,"I malloc'd\n",sizeof("I malloc'd\n"));
  5.         return NULL;
  6. }
  7.  
  8. void alloc_one_meg() {
  9.     int *pmeg = (int *) malloc(250000*sizeof(int));
  10.     int *p = pmeg;
  11. }
  12.  
  13. main()
  14. {
  15.     int i;
  16.     for (i=0; i<1000; i++) {
  17.         alloc_one_meg();
  18.     }
  19. }