From db5990de0305b547f1f3e35718d1aabea2b85580 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sun, 5 May 2024 19:26:07 +0200 Subject: [PATCH] DICT: * Reduce memory allocation usage --- m-dict.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m-dict.h b/m-dict.h index c1c28abe..49d2a1ec 100644 --- a/m-dict.h +++ b/m-dict.h @@ -328,7 +328,7 @@ ARRAY_DEF(m_array_index, m_indexhash_t, M_POD_OPLIST) map->count_delete = 0; \ M_C3(m_d1ct_,name,_update_limit)(map, M_D1CT_INITIAL_SIZE); \ /* The first 2 buckets are reserved for (empty) and (deleted) access. Allocation could be avoided */ \ - map->data = M_CALL_REALLOC(key_oplist, M_F(name, _freelist_ct), NULL, (size_t)(2+M_D1CT_INITIAL_SIZE)); \ + map->data = M_CALL_REALLOC(key_oplist, M_F(name, _freelist_ct), NULL, (size_t) 1+2+map->upper_limit); \ if (M_UNLIKELY_NOMEM (map->data == NULL)) { \ M_MEMORY_FULL( (2+M_D1CT_INITIAL_SIZE) * sizeof (M_F(name, _freelist_ct))); \ return ; \