title: How to set memory limit for thread or process in python?
body: <p>I'm writing program in Python which would be able to run untrusted python code in some kind of sandbox. So, I need a way to limit the amount of memory that untrusted code can allocate. At now I can limit the maximum length of range(), list, dictionary and the others by overriding default python data structures in my sandboxed environment.</p>
  
  <p>Any ideas?</p>