Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!newsfeed.pionier.net.pl!feed.xsnews.nl!border03.ams.xsnews.nl!feeder04.ams.xsnews.nl!feeder03.ams.xsnews.nl!abp002.ams.xsnews.nl!frontend-F09-16.ams.news.kpn.nl From: Cecil Westerhof Newsgroups: comp.lang.python Subject: Re: l = range(int(1E9)) Organization: Decebal Computing References: <87k2wtvbx1.fsf@Equus.decebal.nl> <87zj5ps73z.fsf@Equus.decebal.nl> X-Face: "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR,v+Pti8=Vi/Z"g^?b"E X-Homepage: http://www.decebal.nl/ Date: Fri, 01 May 2015 07:19:51 +0200 Message-ID: <87wq0sri14.fsf@Equus.decebal.nl> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:DC4+GEjKvLNqcXGl4NmgPpPTazs= MIME-Version: 1.0 Content-Type: text/plain Lines: 43 NNTP-Posting-Host: 81.207.62.244 X-Trace: 1430459091 news.kpn.nl 18987 81.207.62.244@kpn/81.207.62.244:42798 Xref: csiph.com comp.lang.python:89697 Op Thursday 30 Apr 2015 23:41 CEST schreef Tim Chase: > 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. Yes, as I already found out you need to use -v. But it would be nice that there was an indication that -m is obsolete. Depending on the available memory you could use something like: ulimit -v $((4 * 1024 * 1024)) I can then do: l = range(int(1E8)) but: l = range(int(1E9)) gives MemoryError. And if I can also do (from another thread): happy_number_list(int(1E8)) if I did not something memory consuming. And if a (Python) process should use significantly less, it could be a good idea to tweak the ulimit call. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof