Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'binary': 0.05; 'modify': 0.05; 'none,': 0.05; 'removes': 0.05; 'executed': 0.07; 'python': 0.09; 'deletion': 0.09; 'garbage': 0.09; 'handlers': 0.09; 'subject:None': 0.09; 'terry': 0.09; 'used).': 0.09; 'variables,': 0.09; 'subject:python': 0.11; 'times,': 0.13; '"del"': 0.16; "compiler's": 0.16; 'executed,': 0.16; 'ia64)': 0.16; 'received:169.254.2': 0.16; 'received:mgd.msft.net': 0.16; 'received:msft.net': 0.16; 'reedy': 0.16; 'return,': 0.16; 'rewritten': 0.16; 'skip:[ 60': 0.16; 'wrote:': 0.17; 'message-----': 0.17; 'variables': 0.17; '(in': 0.18; 'jan': 0.18; 'obviously': 0.18; 'memory': 0.18; '(or': 0.18; 'variable': 0.20; 'to:name:python-list@python.org': 0.20; 'bit': 0.21; 'received:10.3': 0.22; 'subject:release': 0.22; 'wednesday,': 0.22; 'purposes': 0.23; 'to:2**1': 0.23; 'received:169.254': 0.24; 'header:In-Reply-To:1': 0.25; 'setting': 0.26; 'am,': 0.27; 'subject: \n\t': 0.27; "doesn't": 0.28; 'reply.': 0.28; 'idea,': 0.29; 'leaves': 0.29; 'str': 0.29; 'thinks': 0.29; 'url:mailman': 0.29; 'received:169': 0.29; 'probably': 0.29; 'returned': 0.30; 'header:Received:8': 0.30; 'url:python': 0.32; 'generally': 0.32; 'skip:- 10': 0.32; 'url:listinfo': 0.32; 'to:addr:python-list': 0.33; 'monitor': 0.33; 'thanks': 0.34; 'built-in': 0.35; 'received:bigfish.com': 0.35; 'there': 0.35; 'subject:': 0.36; 'tool': 0.36; 'but': 0.36; 'url:org': 0.36; 'depends': 0.36; "wasn't": 0.36; 'email addr:python.org': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'subject: (': 0.36; 'bad': 0.37; 'itself': 0.37; 'does': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'object': 0.38; 'received:10': 0.38; 'there,': 0.38; 'to:addr:python.org': 0.39; 'release': 0.39; 'where': 0.40; 'url:mail': 0.40; 'address': 0.60; 'subject:, ': 0.61; 'email name :python-list': 0.62; 'behavior': 0.64; 'box.': 0.65; 'engage': 0.65; 'subject: ': 0.66; 'restore': 0.69; 'discovered': 0.83; '2.7.1': 0.84; '2013': 0.84; '7:00': 0.84; 'utilized': 0.84; 'glance': 0.91; 'subject:Set': 0.91; 'subject:del': 0.91; 'whereby': 0.91; 'factors': 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: -4 X-BigFish: VS-4(zzbb2dI98dI9371I542I1432Izz1f42h1ee6h1de0h1202h1e76h1d1ah1d2ahzz17326ah8275dhz2dh2a8h668h839h8e2h8e3h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h19ceh1ad9h1b0ahbe9i1155h) From: Wong Wah Meng-R32813 To: Terry Reedy , "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: AQHOGlrjUSW9o23MW0CM+iogfRkkn5iYmJsA Date: Wed, 6 Mar 2013 12:36:04 +0000 References: <390f0dc5-5750-4849-9433-a19d90cc8566@googlegroups.com> <87zjyhhret.fsf@nautilus.nautilus> <78E1273CA6E76A43BB8830A194FF709B0B12EB11@039-SN2MPN1-012.039d.mgd.msft.net> In-Reply-To: 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 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: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362575187 news.xs4all.nl 6895 [2001:888:2000:d::a6]:37039 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40631 Thanks for youre reply. I built python 2.7.1 binary myself on the HP box an= d I wasn't aware there is any configuration or setup that I need to modify = in order to activate or engage the garbage collection (or even setting the = memory size used). Probably you are right it leaves it to the OS itself (in= this case HP-UX) to clean it up as after python removes the reference to t= he address of the variables the OS still thinks the python process should s= till owns it until the process exits.=20 Regards, Wah Meng=20 -----Original Message----- From: Python-list [mailto:python-list-bounces+wahmeng=3Dfreescale.com@pytho= n.org] On Behalf Of Terry Reedy Sent: Wednesday, March 06, 2013 7:00 PM To: 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 3/6/2013 5:11 AM, Wong Wah Meng-R32813 wrote: > Hello there, > > I am using python 2.7.1 built on HP-11.23 a Itanium 64 bit box. > > I discovered following behavior whereby the python process doesn't=20 > seem to release memory utilized even after a variable is set to None,=20 > and "deleted". I use glance tool to monitor the memory utilized by=20 > this process. Obviously after the for loop is executed, the memory=20 > used by this process has hiked to a few MB. However, after "del" is=20 > executed to both I and str variables, the memory of that process still=20 > stays at where it was. Whether memory freed by deleting an object is returned to and taken by the = OS depends on the OS and other factors like like the size and layout of the= freed memory, probably the history of memory use, and for CPython, the C c= ompiler's malloc/free implementation. At various times, the Python memory h= andlers have been rewritten to encourage/facilitate memory return, but Pyth= on cannot control the process. > for i in range(100000L): > str=3Dstr+"%s"%(i,) > i=3DNone; str=3DNone # not necessary > del i; del str Reusing built-in names for unrelated purposes is generally a bad idea, alth= ough the final deletion does restore access to the builtin. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list