1

Need to replicate limited memory on hosting account. In php it's a simple as setting memory_limit in the php.ini config file.

Using VirtualEnv, and not finding any reference to memory in its docs.

I've seen coding Solutions for Linux and Unix, but they aren't working on osX (maybe they would with XTools).

The following script on Unix returns the expected MemoryError on Linux, but on osX 10.6.8 it just runs Python resources above 2GB ('till ended via the osX Activity Monitor as KeyboardInterrupt doesn't seem to do it).

import resource

"""
python break_resources.py
"""

for n in range(0, 1000000000):
    n = n * 100000000000

resource.setrlimit(resource.RLIMIT_CORE, (1, 100))

Experimenting with multiprocessing so there may be certain solutions which will not work in this case.

Community
  • 1
  • 1
MikeiLL
  • 6,282
  • 5
  • 37
  • 68
  • 1
    It doesn’t seem to be possible to do this easily on the mac: http://stackoverflow.com/questions/3274385/how-to-limit-memory-of-a-os-x-program-ulimit-v-neither-m-are-working#comment4987496_3276945 – andrewdotn Aug 19 '14 at 04:24

0 Answers0