From 32d111fecfc14038ebd422e7559d834ad2cc652c Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Fri, 29 Aug 2014 18:21:22 +0400 Subject: [PATCH] Changing pool's chunk size to 8 bytes. Adding configurable value for minimum chunks in a pool allocated by pools' manager: CONFIG_MEM_LEAST_CHUNK_NUMBER_IN_POOL = 32. --- src/config.h | 7 ++++++- src/liballocator/mem-poolman.c | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/config.h b/src/config.h index fbfd0aeb0..12f72a678 100644 --- a/src/config.h +++ b/src/config.h @@ -36,7 +36,12 @@ * * Should not be less than size of any of ECMA Object Model's data types. */ -#define CONFIG_MEM_POOL_CHUNK_SIZE 16 +#define CONFIG_MEM_POOL_CHUNK_SIZE 8 + +/** + * Minimum number of chunks in a pool allocated by pools' manager. + */ +#define CONFIG_MEM_LEAST_CHUNK_NUMBER_IN_POOL 32 /** * Size of heap chunk diff --git a/src/liballocator/mem-poolman.c b/src/liballocator/mem-poolman.c index ffd1be688..e62aa6efe 100644 --- a/src/liballocator/mem-poolman.c +++ b/src/liballocator/mem-poolman.c @@ -100,10 +100,9 @@ mem_pools_alloc (void) { /** * Space, at least for header and eight chunks. - * - * TODO: Config. */ - size_t pool_size = mem_heap_recommend_allocation_size (sizeof (mem_pool_state_t) + 8 * MEM_POOL_CHUNK_SIZE); + size_t pool_chunks_area_size = CONFIG_MEM_LEAST_CHUNK_NUMBER_IN_POOL * MEM_POOL_CHUNK_SIZE; + size_t pool_size = mem_heap_recommend_allocation_size (sizeof (mem_pool_state_t) + pool_chunks_area_size); mem_pool_state_t *pool_state = (mem_pool_state_t*) mem_heap_alloc_block (pool_size, MEM_HEAP_ALLOC_LONG_TERM);