[patch v1] malloc: add malloc_zero_aborts tunable

Wilco Dijkstra Wilco.Dijkstra@arm.com
Fri Feb 13 18:32:03 GMT 2026


Hi DJ,

> Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
>> I think aborting is a bit of a blunt hammer
>
> Yes!  I prefer a "crash early, crash obvious" response to problems I'm
> interested in.

Yes that's generally best. However malloc(0) is not a bug...

>> It would be interesting to be able to enable logging of malloc(0)/realloc(0)
>> calls just to see how frequently they occur. If that is possible inside a standard
>> distro then one could trivially log usage across a large set of applications and
>> usecases.
>
> One could write a LD_PRELOAD library that just checks for this, too, but
> that's a lot more overhead.

True, and more work since it wouldn't be something anyone could just switch on in
a standard distro with an environment variable. I tried the preload method in the
past for logging string/math functions, but it's tricky to write and hard to support
in CI and benchmarking flows.

Cheers,
Wilco


More information about the Libc-alpha mailing list