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" <dave@treblig.org>
Message-ID: <
20250816204252.63616-1-dave@treblig.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
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;
\&