| Java implementations have run-time heap allocator limits configurable with the -Xms and -Xmx options for minimum and maximum heap size, and -Xss for per-thread stack size: java -jar -Xms1024M -Xmx2048M -Xss1M example.jar RAM and CPU and network IO cgroups are harder limits than a process's attempts to bound its own allocation with the VM. TIL about hardened_malloc. Python doesn't have hardened_malloc, and IDK how configurable hardened_malloc is in terms of self-imposed process resource limits. FWIU hardened_malloc groups and thereby contains allocations by size. https://github.com/GrapheneOS/hardened_malloc There is a reason that EVM and eWASM have costed opcodes and do not have socket libraries (blocking or async). The default sys.setrecursionlimit() is 1000; so, 1000 times the unbounded stack size per frame:
https://docs.python.org/3/library/sys.html#sys.setrecursionl... Most (all?) algorithms can be rewritten with a stack instead of recursion, thereby avoiding per-frame stack overhead in languages without TCO Tail-Call Optimization like Python. Kata containers or Gvisor or just RestrictedPython that doesn't run until it's checked into git [and optionally signed]? |