Hi,
Le Saturday 16 August 2008 15:43:28 Facundo Batista, vous avez écrit :
> The test_raiseMemError() in test_unicode.py is complicating me the
> regression tests: tries to use all the memory in my system, which
> starts to swap as crazy, and almost freezes everything.
On UNIX, it's possible to limit a process memory using RLIMIT_AS:
from resource import getrlimit, setrlimit, RLIMIT_AS
def limitMemory(soft):
try:
old_soft, hard = getrlimit(RLIMIT_AS)
if old_soft != -1:
soft = min(soft, old_soft)
except ValueError:
hard = -1
setrlimit(RLIMIT_AS, (soft, hard))
Values are in bytes. So it's possible to get MemoryError without using the
whole system memory.
Victor
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com