6

I was wondering how I would set a limit of 512mb memory (ram) for my Python script?

  • I don't think there's a way to get Python to limit itself, but see this previous question for monitoring memory usage: http://stackoverflow.com/questions/110259/python-memory-profiler – Mark Ransom Jun 24 '11 at 16:47
  • If you're running into memory problems, limiting the memory is just going to make Python have to use swap space a lot more. This will dramatically slow down your code. A better idea would probably be to reduce your memory footprint in any way you can. If you're doing this for testing purposes, however, read S.Lott's response in @ba_friend's link. – Wilduck Jun 24 '11 at 17:11

0 Answers0