Under certain circumstances, calling append() triggers an out of memory panic and it seems append() itself doesn't return nil.
How could I avoid that panic scenario and show to my user "Resource temporary unavailable" ?
Best regards,
You can't.
If the runtime can't allocate memory for append, it may not be able to recover, or communicate "Resource temporary unavailable" to the user. For example, GC might need to allocate to clean up, or the scheduler might be trying to allocate a new thread. Because there's no way to strictly control allocations in a Go program, there's no way to gracefully handle running out of memory.
All OOM conditions terminate a Go program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With