lemoncake

rbtree based memory allocator
git clone git://git.2f30.org/lemoncake.git
Log | Files | Refs | README | LICENSE

commit 54883eeb89e16eb20508d83ed792d9c034b588c7
parent 3baae49ec28d9c310049d1d00b269a57647750cd
Author: sin <sin@2f30.org>
Date:   Mon Aug  5 11:48:00 +0100

Only split out when we have to

Diffstat:
lemoncake.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lemoncake.c b/lemoncake.c @@ -219,10 +219,12 @@ realloc(void *oldp, size_t siz) } if (res->siz > siz) { size_t diff = res->siz - siz; - if (diff < ALIGN + siz) { + /* We cannot ensure the alignment of the free + * block if its size is less than ALIGN - so just + * don't split the node in that case */ + if (diff < ALIGN) { unlock(&rblock); st.nr_realloc++; - st.nr_shrink_realloc++; return res->buf; } newfn = alloc_object(sizeof(*newfn));