Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.086 X-Spam-Evidence: '*H*': 0.83; '*S*': 0.00; 'cpython': 0.05; 'true,': 0.05; 'way:': 0.09; 'python': 0.11; 'circumvent': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'thu,': 0.19; '>>>': 0.22; 'memory': 0.22; 'header:User-Agent:1': 0.23; 'space.': 0.24; 'header:In-Reply- To:1': 0.27; '"",': 0.31; 'claiming': 0.31; 'fedora': 0.31; 'file': 0.32; 'run': 0.32; 'running': 0.33; '(most': 0.33; 'used,': 0.33; 'problem': 0.35; 'something': 0.35; 'there': 0.35; 'really': 0.36; '+0200,': 0.36; 'similar': 0.36; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'space': 0.40; "you've": 0.63; 'address': 0.63; 'more': 0.64; 'charset:windows-1252': 0.65; 'received:74.208': 0.68; 'reverse': 0.68; 'friend': 0.79; '*really*': 0.84; '2015': 0.84; 'presumably': 0.84 Date: Thu, 30 Apr 2015 14:59:42 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: l = range(int(1E9)) References: <87k2wtvbx1.fsf@Equus.decebal.nl> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:F14l40UNA0lPKQLxHYc3xVNhxXVy6nBLakBZVnJKLbPxHy5xhUo W1NZPivdcBYwSmwuw/NQwED4635DO2n7hVlxmq08FlNDLwpcdIJahh0q23Swc9Rr/ClXv8R sbHa5lB2hrPD7ZG+jDzGZBDnzvJXae7ialaArZrwaFH3XyiYOCGKBYEsa6cHJX77HS0xdmn BmCHeP25StKNFJVEc4aww== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430420396 news.xs4all.nl 2872 [2001:888:2000:d::a6]:46476 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:89658 On 04/30/2015 02:48 PM, alister wrote: > 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 > That's presumably because you end up running out of address space before you run out of swap space. On a 64 bit system the reverse will be true, unless you have a really *really* large swap file ulimit is your friend if you've got a program that wants to gobble up all of swap space. -- DaveA