Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. void try_newheap(){
  2.     unsigned int testA;
  3.     unsigned int testB;
  4.     unsigned int testC;
  5.     //printf("Testing the new heap (in development)\n");
  6.     //printf("First step: testing a new heap...\n");
  7.     //new_heap(HEAP_START_ADDRESS, HEAP_START_SIZE);
  8.     printf("Second step: trying new_malloc...\n"); 
  9.     testA=(unsigned int)new_malloc(8); 
  10.     printf("-Address of testA Hex: 0x%x\n", testA);
  11.     testB=(unsigned int)new_malloc(8);
  12.     printf("-Address of testB Hex: 0x%x\n", testB);
  13.     //printf("testB - testA = %u", testB - testA);
  14.     testC=new_malloc(8);
  15.     printf("-Address of testC Hex: 0x%x\n", testC);
  16.     new_free(testC);
  17.     new_free(testB);
  18.     unsigned int testD;
  19.     unsigned int testE;
  20.     testD = new_malloc(12);
  21.     testE = new_malloc(12);
  22.     printf("-Address of testD Hex: 0x%x\n", testD);
  23.     //printf("-Address of testE Hex: 0x%x\n", testE);
  24.     new_free(testA);
  25.     new_free(testE);
  26.     new_free(testD);
  27.     printf("DONE\n");
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement