3 ms·
That depends on what you mean by ‘crashing,’ doesn’t it? One could at least fail gracefully: at start-up, request enough memory for a buffer reading ‘request t
by eadmund 4y ago
That depends on what you mean by ‘crashing,’ doesn’t it?
One could at least fail gracefully: at start-up, request enough memory for a buffer reading ‘request to allocate memory failed; exiting’ and then print it to standard output, then exit.
One might initiate a garbage collection cycle.
One might even allocate enough buffers at start-up to cleanly process outstanding work, write results and then terminate.
It requires a little thought and engineering, but there are approaches which don’t just dump core.
- tinus_hn 4y agoFor very large values of ‘a little’. Just like that other poster with the ‘easy’ solutions, I challenge you to actually implement a demonstration of those easy ideas. You can actually take some ideas from the Linux kernel if you like because it has what you propose, a way to allocate memory that never fails and never blocks. And there you can tell how easy that is.