My advice on implementing stuff in C:
Posted Oct 25, 2010 10:05 UTC (Mon) by
hppnq (guest, #14462)
In reply to:
My advice on implementing stuff in C: by nix
Parent article:
Russell: On C Library Implementation
The only way to avoid *that* [stack-OOM] is to do a deep recursion first, and then ensure that you never call functions further down in the call stack than you have already allocated, neither in your code nor in any library you may call.
You would have to know in advance how deep you can recurse, or you should be able to handle SIGSEGV. The maximum stack size can be tuned through rlimits, and that should solve wahern's problem of some other process draining out all available memory. This problem is not the result of bad programming, but of bad systems management.
(That said, rlimits are horribly broken. Just add more memory. ;-)
(
Log in to post comments)