l = range(int(1E9))

Tim Chase python.list at tim.thechases.com
Thu Apr 30 17:41:37 EDT 2015


On 2015-04-30 22:18, Cecil Westerhof wrote:
> Op Thursday 30 Apr 2015 20:59 CEST schreef Dave Angel:
>> ulimit is your friend if you've got a program that wants to gobble
>> up all of swap space.
> 
> Yes, my system is openSUSE 64 bit. I really should look into ulimit.
> The default is:
[snip]
>     max memory size         (kbytes, -m) unlimited

Note that AFAIK, "ulimit -m" doesn't work on Linux

http://unix.stackexchange.com/questions/129587/does-ulimit-m-not-work-on-modern-linux

Based on some quick testing[1], it doesn't appear to work on OpenBSD
or FreeBSD either.

-tkc


[1]
My test was to perform the following:

1) seq 20 > data.txt # to generate some random date

2) ed data.txt

3) find the PID of the "ed" process from another window using "ps ax
| grep ed"

4) make note of the current memory used for that PID using "top -p
$PID"

5) issue ",t$" in ed until the memory-used jumps up in the "top"
window (this copies the entire file to the bottom of the file,
doubling the size each time)

6) quit ed without saving ("Q")

7) issue "ulimit -m", specifying a threshold between the
before-the-memory-jump and after-the-memory-jump values

8) repeat steps 2-5 until the memory jumps up in top.  Notice that
it's possible to do this multiple times and exceed the "ulimit -m"
threshold, something the ulimit should prevent.




.



More information about the Python-list mailing list