test.c 457 B

12345678910111213141516171819202122
  1. #include <stdio.h>
  2. #include "heap.h"
  3. #include "other.h"
  4. #include "LeaHeader.h"
  5. #include "dmm_init.h"
  6. #include "custom_malloc.h"
  7. #include "custom_free.h"
  8. int main(void) {
  9. allocator_t *myallocator;
  10. heap_t *myheap;
  11. int heap_id;
  12. void *p;
  13. myallocator = dmm_init();
  14. heap_id = map_thread_heap();
  15. printf("This thread accesses heap %d\n", heap_id);
  16. myheap = &myallocator->heaps[heap_id];
  17. p = custom_malloc(myheap, (size_t) 32);
  18. custom_free(myheap, p);
  19. }