logoalt Hacker News

dnauticslast Sunday at 11:37 PM5 repliesview on HN

stacktraces? might also be useful to know whether or not the latest allocand was a jumbo sized allocand that caused the failure?


Replies

dwatttttlast Sunday at 11:45 PM

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.

show 1 reply
mswphdyesterday at 7:21 PM

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.

SkiFire13yesterday at 8:09 AM

And how do you store a stacktrace without allocating?

imtringuedyesterday at 2:23 PM

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.

63stackyesterday at 7:28 AM

Any time I mention "but I would like stacktraces with my errors" I get told I'm doing it wrong.

show 1 reply