stacktraces? might also be useful to know whether or not the latest allocand was a jumbo sized allocand that caused the failure?
if you have an OOM and want to log why, if your logging allocates it will likely fail as well. You could in principle work around this with enough effort, but "properly" handling OOM is typically much more trouble than its worth.
And how do you store a stacktrace without allocating?
If you let the allocation error panic you will get your stack trace.
You can't have a stack trace on an error in the error path that failed to allocate. If you have a "jumbo sized" error and the error fails to allocate, it won't get reported. The only reporting you will get is that the error failed to allocate and this new allocation error overrides the error that failed to allocate.
Any time I mention "but I would like stacktraces with my errors" I get told I'm doing it wrong.
Do you really want that data passed back down to the caller of the allocation? From the description of the failure state you'd want to log that data instead: what's the caller of the allocation going to do if you tell it it failed with a crazy size? It already knows the size, it's the one who asked for it.