From ade1fd8fff4a3d750c5c85c63da5c7371fc82f17 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 9 Feb 2025 14:38:01 +0100 Subject: [PATCH] Fixed incorrect memory allocations --- lib/mem/alloc_linux.q | 2 +- lib/mem/alloc_mac.q | 4 ++-- lib/mem/alloc_windows.q | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/mem/alloc_linux.q b/lib/mem/alloc_linux.q index df8fe5b..2389b04 100644 --- a/lib/mem/alloc_linux.q +++ b/lib/mem/alloc_linux.q @@ -3,7 +3,7 @@ import sys alloc(length Int) -> Pointer { x := sys.mmap(0, length+8, 0x1|0x2, 0x02|0x20) - if x <= 0 { + if x < 0x1000 { return x } diff --git a/lib/mem/alloc_mac.q b/lib/mem/alloc_mac.q index 42da24b..6ffda84 100644 --- a/lib/mem/alloc_mac.q +++ b/lib/mem/alloc_mac.q @@ -1,9 +1,9 @@ import sys alloc(length Int) -> Pointer { - x := sys.mmap(0, length, 0x1|0x2, 0x02|0x1000) + x := sys.mmap(0, length+8, 0x1|0x2, 0x02|0x1000) - if x <= 0 { + if x < 0x1000 { return x } diff --git a/lib/mem/alloc_windows.q b/lib/mem/alloc_windows.q index 616fb84..d448dd0 100644 --- a/lib/mem/alloc_windows.q +++ b/lib/mem/alloc_windows.q @@ -1,9 +1,9 @@ import sys alloc(length Int) -> Pointer { - x := sys.mmap(0, length, 0x0004, 0x3000) + x := sys.mmap(0, length+8, 0x0004, 0x3000) - if x <= 0 { + if x < 0x1000 { return x }