I'm using a Python library (SimpleParse) that I seem to be causing some runaway recursion with it. It's already crashed my computer once when I was just trying to debug it.
What would be the best way for me to set some limits on how much memory it's using?
I was thinking I would write up a quick C program with setrlimit to call Python, and test it from there.
Python provides setrlimit()
, so you can stay in Python. (Unless you're happier in C :)
Note that the Linux kernel hasn't supported the RSS accounting in a long time; the address space accounting is probably your best bet, but it might be overly restrictive. (If the program mmap(2)
s a few gigabytes but never bothers reading or writing it, it won't really matter; the rlimits might forbid the mmap(2)
, rather than forbid actually using the memory.)