Path: csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.083 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'cpython': 0.05; 'way:': 0.09; 'python': 0.11; 'circumvent': 0.16; 'wrote:': 0.18; 'memory': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply- To:1': 0.27; '"",': 0.31; 'claiming': 0.31; 'file': 0.32; '(most': 0.33; 'used,': 0.33; 'problem': 0.35; 'something': 0.35; 'there': 0.35; 'similar': 0.36; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:212.82': 0.60; 'more': 0.64; 'received:46': 0.66; 'from:addr:yahoo.no': 0.84; 'message- id:@yahoo.no': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.no; s=s2048; t=1430418204; bh=x+SL0L6CAOJQ6JfMbSZOmgnSoC+ejdOEIdzB0AtATM0=; h=Date:From:To:Subject:References:In-Reply-To:From:Subject; b=uYBwKnvMFyQNJcvkUqWQD5sNJn6WzCFFoauCBvFmrsD3KdbpU43arEEcaCc45ju++gW/pPui7Y/wPcAn9J86UlGYrk5wfD8kP6ExXZrjG5Y7EGJw7Kf7W3p/mVwaHgSJiaAjIa9CgMMT9UjI1g/2q0u4BTFVQYaYt3AG/zMM/hD+NZmkhssFbVJLgDBaEbd7gNPoF+MxoXyv2qGOPPho/7j7uz6Fm83VmmiaIF7wJDUDo7QRVMaPpPBKuAIv6cSD5/+Jxyg2F2CtDjj/Z1FTHJ/X5mnBc/zzI6AErZ9BMp7X21cKPln1PBIwc/FVy9kCQlpDnEvkSuaWQY9d3/Og5Q== X-Yahoo-Newman-Id: 891719.32431.bm@smtp113.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: RWix1j8VM1ma4eKCNsqeRmab3pVPvGXizKs0ijfcHzuAT1z g6Q4Ydyd8miSvU9oECsDgoHkmQ52_iJhsLOktuCPSXJ64831cpDJS5KeIs_8 gTVLr.kjtUIMorD8N32btz0_b4EODdiNU2SuYmZd_hpcKMODO17y_.9wc9M_ gUIptM5CIwFTkMiLBW2k3Oh9yFwQt85hyNBpwxYquc6R.ts6T93.r48FttQ1 zYM7cDR_.ix5duLZfCUWFC0EThySvQMD7k7UoqooaFrqED1DAQoerSNjpwZd AMAPhzya68YIyr5cI2UpjQKelTTCYimbqIoUnrCjCOSJqnE986Cl5luBK7ZG 2yZiqprSoYUwrrJ14g8R21rh6eaybKfMQ8JgNrCUPeToGE5fOM65QvDMbmFp aqKCvGFu8r6Skx2OXTEY2ocyRutTBtWRCEph.RUxPiPuGz3bTiSEMNvPHlrH FbgC5dN11kwZINJmSt3tSydHQuL8yAU1D21WuxcS8eqOLBdePFw7Yigj98DN sOk4BvRnxqCRQEwc2iIOwvtFb X-Yahoo-SMTP: 8zhYLGyswBB3AGU8c4pvFIFOfA-- Date: Thu, 30 Apr 2015 20:23:31 +0200 From: Gisle Vanem User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: l = range(int(1E9)) References: <87k2wtvbx1.fsf@Equus.decebal.nl> In-Reply-To: <87k2wtvbx1.fsf@Equus.decebal.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430418355 news.xs4all.nl 2836 [2001:888:2000:d::a6]:33205 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:89655 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