Hacker News new | ask | show | jobs
by spyc 456 days ago
The point of termination is beyond stack overflow here, that's the problem. And unlike heap, stack does not tell you gently that it's running out.
1 comments

That really depends. Segmented stack makes it equivalent to heap. Heap might or might not fail gracefully. If the OS permits overcommit and you've mapped a large region, then an arbitrary process on the machine could trigger the OOM when writing to a supposedly allocated (but not previously written) piece of memory.

Presumably you configure resource limits in production but that just means the "correct" process gets unexpectedly killed instead of an arbitrary one.

Code handling arbitrary input needs to carefully limit resource usage. There's no avoiding it.