diff --git a/benchmarks/allocator/allocator_shared_object_file.c b/benchmarks/allocator/allocator_shared_object_file.c index 0eca7c0..880eba3 100644 --- a/benchmarks/allocator/allocator_shared_object_file.c +++ b/benchmarks/allocator/allocator_shared_object_file.c @@ -180,6 +180,8 @@ static size_t sizeUsed; // } +static int notrun = 0; + static int pagesizes(size_t ps[MAXPAGESIZES]) { @@ -252,17 +254,17 @@ static void INITREGULARALLOC(void) { } MallocCounter = (int)sz; + notrun = 1; } -int notrun = 0; + // Quick malloc implementation with mmap void* malloc(size_t sz) { // If malloc is called for the first time then allocate huge page -// if (notrun == 0) { -// INITREGULARALLOC(); -// notrun = 1; -// } + if (notrun == 0) { + INITREGULARALLOC(); + } sz = __builtin_align_up(sz, _Alignof(max_align_t)); // printf("%d \n", sz); @@ -281,17 +283,17 @@ void* malloc(size_t sz) } // Quick cheri free implementation -// void free(void *ptr) { +void free(void *ptr) { -// // printf("free called \n"); + // printf("free called \n"); -// // get bounds from -// int len = cheri_getlen(ptr); + // get bounds from + int len = cheri_getlen(ptr); -// // printf("free len %d \n", len); + // printf("free len %d \n", len); -// munmap(ptr, len); -// } + munmap(ptr, len); +} // Standard Alloc // void* MALLOCREGULAR(size_t sz) {