diff --git a/c/malloc_speed_test/pool_list.c b/c/malloc_speed_test/pool_list.c index b6034e7..ee6fd86 100644 --- a/c/malloc_speed_test/pool_list.c +++ b/c/malloc_speed_test/pool_list.c @@ -93,14 +93,14 @@ inline void pool_free(void *p) busy_pool = b2; } -void *mem[MAX_I]; - int main() { unsigned long long i; init(); + + void **mem = malloc(MAX_I * sizeof(void *)); for (i = 0; i < MAX_I; i++) if (!(mem[i] = pool_alloc())) { @@ -111,6 +111,8 @@ int main() for (i = 0; i < MAX_I; i++) pool_free(mem[i]); + free(mem); + return 0; }