MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / init_mem_alloc

Function init_mem_alloc

libCacheSim/utils/dep/mem.c:71–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void init_mem_alloc(mem_allocator_t *mem_alloc) {
72 pthread_mutex_init(&mem_alloc->mtx, NULL);
73 pthread_mutex_lock(&mem_alloc->mtx);
74// mem_alloc->cache_obj_mem_arena[0] = g_new0(cache_obj_t, N_OBJ_MEM_ARENA);
75// mem_alloc->cache_obj_mem_arena[0] = (cache_obj_t*) malloc(MEM_ARENA_SIZE);
76
77 mem_alloc->cache_obj_mem_arena[0] = (cache_obj_t*) _allocate_memory(MEM_ARENA_SIZE);
78 mem_alloc->cur_arena_idx = 0;
79 mem_alloc->idx_in_cur_arena = 0;
80 mem_alloc->free_list = g_queue_new();
81 VERBOSE("init mem_alloc %p - free_list %p\n", mem_alloc, mem_alloc->free_list);
82 pthread_mutex_unlock(&mem_alloc->mtx);
83}
84
85void free_mem_alloc(mem_allocator_t *mem_alloc) {
86 pthread_mutex_lock(&mem_alloc->mtx);

Callers 1

Calls 1

_allocate_memoryFunction · 0.85

Tested by

no test coverage detected