Re: [PATCH v2 1/2] tools/nolibc: stop rounding malloc() sizes up to 4096 bytes

From: Thomas Weißschuh

Date: Sat Sep 26 2026 - 11:58:42 EST


On 2026-09-26 10:24:13-0500, Danish Khateeb wrote:
> malloc() rounds the size of each mapping up to a multiple of 4096,
> presumably to align it to a page boundary. But the page size is not 4096
> on all architectures, and mmap() and munmap() round the length up to the
> page size themselves.
>
> Drop the rounding. As heap->len is no longer rounded up, growing a block
> with realloc() now always creates a new mapping.

The series looks good to me, but I want to hear from Willy before
applying it.

> Assisted-by: LLM
> Signed-off-by: Danish Khateeb <danishkhateeb03@xxxxxxxxx>

I'll add a Suggested-by here when applying.

> ---
> tools/include/nolibc/stdlib.h | 2 --
> 1 file changed, 2 deletions(-)

(...)