Re: [PATCH] man/man3/mallinfo.3: Reduce MAX_ALLOCS
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-08-16 21:21:38
Attachments
- signature.asc [application/pgp-signature] 833 bytes
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-08-16 21:21:38
On Sat, Aug 16, 2025 at 09:42:52PM +0100, dave@treblig.org wrote:
From: "Dr. David Alan Gilbert" <redacted> The current mallinfo2 example segfaults on 64bit Linux. This happens because it builds a large 'alloc' array on the stack, which is currently 2M entries, each of which is a pointer, so hitting 16MB which is more than the default Linux stack ulimit of 8MiB. Reduce it. Signed-off-by: Dr. David Alan Gilbert <redacted>
Hi David, I've applied the patch. Thanks! <https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=e7dab53687ed61b451eb1b5a2e46ac251f25c22c> Have a lovely night! Alex
--- man/man3/mallinfo.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/man/man3/mallinfo.3 b/man/man3/mallinfo.3 index 5e722e38e..0e1deb748 100644 --- a/man/man3/mallinfo.3 +++ b/man/man3/mallinfo.3@@ -282,7 +282,7 @@ .SS Program source int main(int argc, char *argv[]) { -#define MAX_ALLOCS 2000000 +#define MAX_ALLOCS 500000 char *alloc[MAX_ALLOCS]; size_t blockSize, numBlocks, freeBegin, freeEnd, freeStep; \&-- 2.50.1
-- <https://www.alejandro-colomar.es/>