#include #include "heap.h" #include "other.h" #include "posix_lock.h" #include "dmm_init.h" void *first_fit_search(unsigned int size, NODE *starting_node, char is_fixed_global) { NODE *node; node = starting_node; while(node) { } } void *custom_malloc(heap_t* heap, unsigned int size); void *custom_malloc(heap_t* heap, unsigned int size) { void *ptr; int fixed_list_id; ptr = NULL; posix_lock(heap); fixed_list_id = map_size_to_list(heap, size); if(fixed_list_id != -1) { // first fit from fixed list } if(ptr == NULL) { // first fit from free list } posix_unlock(heap); return ptr; } int main(void) { allocator_t *myallocator; heap_t *myheap; int heap_id; myallocator = dmm_init(); heap_id = map_thread_heap(); printf("This thread accesses heap %d\n", heap_id); myheap = &myallocator->heaps[heap_id]; }