aboutsummaryrefslogtreecommitdiffstats
path: root/src/zone.c
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-27 11:13:19 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-27 11:13:19 +0100
commitfb19b1c35f6ec52c075b214d2f0416900a7c1bbe (patch)
treedd323940d5e60253e60626c5065393ad4ec3a24d /src/zone.c
parent8849d801b9d3767390e3e1ed6b562db738ac1bcb (diff)
downloadmalloc-fb19b1c35f6ec52c075b214d2f0416900a7c1bbe.tar.gz
malloc-fb19b1c35f6ec52c075b214d2f0416900a7c1bbe.zip
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).
Diffstat (limited to 'src/zone.c')
-rw-r--r--src/zone.c2
1 files changed, 1 insertions, 1 deletions
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));
}