Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.ecp.fr!aioe.org!.POSTED!not-for-mail From: alister Newsgroups: comp.lang.python Subject: Re: l = range(int(1E9)) Date: Thu, 30 Apr 2015 18:48:10 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 32 Message-ID: References: <87k2wtvbx1.fsf@Equus.decebal.nl> NNTP-Posting-Host: i/OG3EjHvs04xHrpB0XnAg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.python:89656 On Thu, 30 Apr 2015 20:23:31 +0200, Gisle Vanem wrote: > Cecil Westerhof wrote: > >> If I execute: >> l = range(int(1E9) >> >> The python process gobbles up all the memory and is killed. The problem >> is that after this my swap is completely used, because other processes >> have swapped to it. This make those programs more slowly. Is there a >> way to circumvent Python claiming all the memory? >> >> By the way: this is CPython 2.7.8. > > On what OS? If I try something similar on Win-8.1 and CPython 2.7.5 > (32-bit): > > python -c "for i in range(int(1E9)): pass" > Traceback (most recent call last): > File "", line 1, in > MemoryError > > > --gv also MemoryError on Fedora 21 32 bit -- I am a traffic light, and Alan Ginzberg kidnapped my laundry in 1927!