Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'explicitly': 0.04; 'none,': 0.05; 'executed': 0.07; 'python': 0.09; 'garbage': 0.09; 'received:216.32.180': 0.09; 'subject:None': 0.09; 'variables,': 0.09; 'cc:addr:python-list': 0.10; 'itself.': 0.11; 'subject:python': 0.11; '"del"': 0.16; 'bryan': 0.16; 'executed,': 0.16; 'gc.collect()': 0.16; 'ia64)': 0.16; 'received:169.254.2': 0.16; 'received:mgd.msft.net': 0.16; 'received:msft.net': 0.16; 'runs.': 0.16; 'skip:[ 60': 0.16; 'utc,': 0.16; 'wrote:': 0.17; 'message-----': 0.17; 'obviously': 0.18; '>>>': 0.18; 'memory': 0.18; 'variable': 0.20; 'question.': 0.20; 'to:name:python- list@python.org': 0.20; 'bit': 0.21; 'subject:release': 0.22; 'wednesday,': 0.22; 'cc:2**0': 0.23; 'references': 0.23; "haven't": 0.23; 'to:2**1': 0.23; 'received:169.254': 0.24; 'idea': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'leave': 0.26; 'thanks!': 0.26; 'question': 0.27; 'received:216.32': 0.27; 'subject: \n\t': 0.27; "doesn't": 0.28; 'post': 0.28; 'question:': 0.29; 'str': 0.29; 'url:mailman': 0.29; 'objects': 0.29; 'received:169': 0.29; 'probably': 0.29; "i'm": 0.29; 'header:Received:8': 0.30; 'url:python': 0.32; 'skip:- 10': 0.32; 'url:listinfo': 0.32; 'idle': 0.33; 'to:addr :python-list': 0.33; 'monitor': 0.33; 'hi,': 0.33; 'another': 0.33; 'received:bigfish.com': 0.35; 'said,': 0.35; 'next': 0.35; 'subject:': 0.36; 'tool': 0.36; 'but': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; "didn't": 0.36; 'should': 0.36; 'too': 0.36; 'charset:us-ascii': 0.36; 'subject: (': 0.36; 'enough': 0.36; 'itself': 0.37; 'uses': 0.37; 'being': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'object': 0.38; 'received:10': 0.38; 'delete': 0.38; 'there,': 0.38; 'to:addr:python.org': 0.39; 'release': 0.39; 'takes': 0.39; 'where': 0.40; 'url:mail': 0.40; 'your': 0.60; 'subject:, ': 0.61; 'free': 0.61; 'received:216': 0.62; 'email name:python-list': 0.62; 'more': 0.63; 'behavior': 0.64; 'making': 0.64; 'here': 0.65; 'box.': 0.65; 'hours': 0.66; 'subject: ': 0.66; 'discovered': 0.83; '2.7.1': 0.84; '2013': 0.84; "else's": 0.84; 'footprint': 0.84; 'reduced.': 0.84; 'replies.': 0.84; 'utilized': 0.84; 'why?': 0.84; 'forgotten': 0.91; 'glance': 0.91; 'subject:Set': 0.91; 'subject:del': 0.91; 'whereby': 0.91; 'mistakes': 0.95 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: -6 X-BigFish: VS-6(zz98dI9371I103dK542I1432Izz1f42h1ee6h1de0h1202h1e76h1d1ah1d2ahzz17326ah8275dhz2dh2a8h668h839h8e2h8e3h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h19ceh1ad9h1b0ahbe9i1155h) From: Wong Wah Meng-R32813 To: Bryan Devaney , "python-list@python.org" Subject: RE: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Thread-Topic: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Thread-Index: AQHOGlZuDMJ4OSQRYEmtvx3/7gtNTJiYl8jg Date: Wed, 6 Mar 2013 12:31:47 +0000 References: <390f0dc5-5750-4849-9433-a19d90cc8566@googlegroups.com> <87zjyhhret.fsf@nautilus.nautilus> <18272cff-cfb0-4bd3-8f5d-3b4641ba828e@googlegroups.com> In-Reply-To: <18272cff-cfb0-4bd3-8f5d-3b4641ba828e@googlegroups.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [175.139.129.22] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: freescale.com Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 68 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362574941 news.xs4all.nl 6923 [2001:888:2000:d::a6]:34460 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40630 Apologies as after I have left the group for a while I have forgotten how n= ot to post a question on top of another question. Very sorry and appreciate= your replies.=20 I tried explicitly calling gc.collect() and didn't manage to see the memory= footprint reduced. I probably haven't left the process idle long enough to= see the internal garbage collection takes place but I will leave it idle f= or more than 8 hours and check again. Thanks!=20 -----Original Message----- From: Python-list [mailto:python-list-bounces+wahmeng=3Dfreescale.com@pytho= n.org] On Behalf Of Bryan Devaney Sent: Wednesday, March 06, 2013 6:25 PM To: python-list@python.org Cc: python-list@python.org Subject: Re: Set x to to None and del x doesn't release memory in python 2.= 7.1 (HPUX 11.23, ia64) On Wednesday, March 6, 2013 10:11:12 AM UTC, Wong Wah Meng-R32813 wrote: > Hello there, >=20 >=20 >=20 > I am using python 2.7.1 built on HP-11.23 a Itanium 64 bit box.=20 >=20 >=20 >=20 > I discovered following behavior whereby the python process doesn't seem t= o release memory utilized even after a variable is set to None, and "delete= d". I use glance tool to monitor the memory utilized by this process. Obvio= usly after the for loop is executed, the memory used by this process has hi= ked to a few MB. However, after "del" is executed to both I and str variabl= es, the memory of that process still stays at where it was.=20 >=20 >=20 >=20 > Any idea why? >=20 >=20 >=20 > >>> for i in range(100000L): >=20 > ... str=3Dstr+"%s"%(i,)=20 >=20 > ...=20 >=20 > >>> i=3DNone >=20 > >>> str=3DNone >=20 > >>> del i >=20 > >>> del str Hi, I'm new here so I'm making mistakes too but I know they don't like it w= hen you ask your question in someone else's question.=20 that being said, to answer your question: Python uses a 'garbage collector'. When you delete something, all reference= s are removed from the object in memory, the memory itself will not be free= d until the next time the garbage collector runs. When that happens, all ob= jects without references in memory are removed and the memory freed. If yo= u wait a while you should see that memory free itself. --=20 http://mail.python.org/mailman/listinfo/python-list