From bd5be982e9f6005ecbac76f04c879b6039ad278a Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 16 Jul 2026 10:24:16 +0300 Subject: [PATCH] LibC: Don't memset 0 mmap'd callocs There is no reason to page everything in and the kernel already guarantees that the memory is zeroed in mmap --- userspace/libraries/LibC/malloc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/userspace/libraries/LibC/malloc.cpp b/userspace/libraries/LibC/malloc.cpp index 6de1a611..12efe1c6 100644 --- a/userspace/libraries/LibC/malloc.cpp +++ b/userspace/libraries/LibC/malloc.cpp @@ -370,7 +370,8 @@ void* calloc(size_t nmemb, size_t size) if (ptr == nullptr) return nullptr; - memset(ptr, 0, total); + if (total < s_mmap_threshold) + memset(ptr, 0, total); return ptr; }