I run Python 2.7 on a Linux machine with 16GB Ram and 64 bit OS. A python script I wrote can load too much data into memory, which slows the machine down to the point where
resource.RLIMIT_VMEM is the resource corresponding to ulimit -v.
RLIMIT_DATA
only affects brk/sbrk system calls while newer memory managers tend to use mmap instead.
The second thing to note is that ulimit/setrlimit only affects the current process and its future children.
Regarding the AttributeError: 'module' object has no attribute 'RLIMIT_VMEM'
message: the resource module docs mention this possibility:
This module does not attempt to mask platform differences — symbols not defined for a platform will not be available from this module on that platform.
According to the bash ulimit source linked to above, it uses RLIMIT_AS
if RLIMIT_VMEM
is not defined.