Sandboxed Python: memory limits?

Chris Angelico rosuav at
Wed Apr 6 20:10:33 EDT 2011

On Thu, Apr 7, 2011 at 10:06 AM, Chris Angelico <rosuav at> wrote:
> I'm not too concerned about extensions, here; in any case, I lock most
> of them off. I just want to prevent stupid stuff like this:
> a='a'
> while True:
>    a+=a
> from bringing the entire node to its knees. Obviously that will
> eventually bomb with MemoryError, but I'd rather it be some time
> *before* the poor computer starts thrashing virtual memory.

To clarify: One node will be hosting multiple clients' code, and if it
runs out of physical memory, performance for everyone else will be
severely impacted. So I'm hoping to restrict the script's ability to
consume all of memory, without (preferably) ulimit/rlimiting the
entire process (which does other things as well). But if it can't be,
it can't be.

Chris Angelico

More information about the Python-list mailing list