From fb19b1c35f6ec52c075b214d2f0416900a7c1bbe Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Fri, 27 Feb 2026 11:13:19 +0100 Subject: Add chunk splitting and free-chunk search, use sysconf for page size malloc now searches zones for a free chunk, splits it to the requested aligned size, and allocates a new zone when none have space. Replace getpagesize() with sysconf(_SC_PAGESIZE). --- src/zone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/zone.c') diff --git a/src/zone.c b/src/zone.c index 724237b..35d64ef 100644 --- a/src/zone.c +++ b/src/zone.c @@ -16,7 +16,7 @@ _s_zone_size (size_t alloc_max) chunk_size = ALIGN (sizeof (t_chunk)) + ALIGN (alloc_max); total = ALIGN (sizeof (t_zone)) + MIN_ALLOC_COUNT * chunk_size; - page_size = (size_t)getpagesize (); + page_size = (size_t)sysconf (_SC_PAGESIZE); return ((total + page_size - 1) & ~(page_size - 1)); } -- cgit v1.2.3