Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40631

RE: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64)

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 <r32813@freescale.com>
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 <r32813@freescale.com>
To Terry Reedy <tjreedy@udel.edu>, "python-list@python.org" <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> <kh77jf$ljl$1@ger.gmane.org>
In-Reply-To <kh77jf$ljl$1@ger.gmane.org>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2941.1362575187.2939.python-list@python.org> (permalink)
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

Show key headers only | View raw


Thanks for youre reply. I built python 2.7.1 binary myself on the HP box and 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 the address of the variables the OS still thinks the python process should still owns it until the process exits. 

Regards,
Wah Meng 

-----Original Message-----
From: Python-list [mailto:python-list-bounces+wahmeng=freescale.com@python.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 
> seem to release memory utilized even after a variable is set to None, 
> and "deleted". I use glance tool to monitor the memory utilized by 
> this process. Obviously after the for loop is executed, the memory 
> used by this process has hiked to a few MB. However, after "del" is 
> executed to both I and str variables, the memory of that process still 
> 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 compiler's malloc/free implementation. At various times, the Python memory handlers have been rewritten to encourage/facilitate memory return, but Python cannot control the process.

> for i in range(100000L):
>      str=str+"%s"%(i,)
> i=None; str=None   # not necessary
 > del i; del str

Reusing built-in names for unrelated purposes is generally a bad idea, although the final deletion does restore access to the builtin.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

sync databse table based on current directory data without losign previous values Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 23:45 -0800
  Re: sync databse table based on current directory data without losign previous values Lele Gaifax <lele@metapensiero.it> - 2013-03-06 09:19 +0100
    Re: sync databse table based on current directory data without losign previous values Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 00:57 -0800
      Re: sync databse table based on current directory data without losign previous values Lele Gaifax <lele@metapensiero.it> - 2013-03-06 10:24 +0100
        Re: sync databse table based on current directory data without losign previous values Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 01:41 -0800
          Re: sync databse table based on current directory data without losign previous values Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 01:43 -0800
            Re: sync databse table based on current directory data without losign previous values Bryan Devaney <bryan.devaney@gmail.com> - 2013-03-06 02:15 -0800
            Re: sync databse table based on current directory data without losign previous values Bryan Devaney <bryan.devaney@gmail.com> - 2013-03-06 02:15 -0800
          Re: sync databse table based on current directory data without losign previous values Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 01:43 -0800
          Re: sync databse table based on current directory data without losign previous values Lele Gaifax <lele@metapensiero.it> - 2013-03-06 11:27 +0100
          Re: sync databse table based on current directory data without losign previous values Dave Angel <davea@davea.name> - 2013-03-06 08:31 -0500
          Re: sync databse table based on current directory data without losign previous values Lele Gaifax <lele@metapensiero.it> - 2013-03-06 15:16 +0100
        Re: sync databse table based on current directory data without losign previous values Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 01:41 -0800
    Re: sync databse table based on current directory data without losign previous values Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 00:57 -0800
  Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Wong Wah Meng-R32813 <r32813@freescale.com> - 2013-03-06 10:11 +0000
    Re: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Bryan Devaney <bryan.devaney@gmail.com> - 2013-03-06 02:25 -0800
      RE: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Wong Wah Meng-R32813 <r32813@freescale.com> - 2013-03-06 12:31 +0000
      Re: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Dave Angel <davea@davea.name> - 2013-03-06 08:18 -0500
      Re: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Dave Angel <davea@davea.name> - 2013-03-06 08:25 -0500
    Re: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Bryan Devaney <bryan.devaney@gmail.com> - 2013-03-06 02:25 -0800
    Re: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-06 23:34 +0000
      RE: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Wong Wah Meng-R32813 <r32813@freescale.com> - 2013-03-07 06:33 +0000
      Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Chris Angelico <rosuav@gmail.com> - 2013-03-07 18:19 +1100
      RE: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Wong Wah Meng-R32813 <r32813@freescale.com> - 2013-03-08 09:08 +0000
      Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-03-08 19:40 -0500
      RE: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Wong Wah Meng-R32813 <r32813@freescale.com> - 2013-03-09 08:07 +0000
        Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Grant Edwards <invalid@invalid.invalid> - 2013-03-09 19:18 +0000
          Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Roy Smith <roy@panix.com> - 2013-03-09 15:04 -0500
            Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Grant Edwards <invalid@invalid.invalid> - 2013-03-09 20:35 +0000
              Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Roy Smith <roy@panix.com> - 2013-03-09 16:44 -0500
                Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Grant Edwards <invalid@invalid.invalid> - 2013-03-11 14:27 +0000
      Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Dave Angel <davea@davea.name> - 2013-03-09 06:02 -0500
      Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Isaac To <isaac.to@gmail.com> - 2013-03-09 23:02 +0800
  Re: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Terry Reedy <tjreedy@udel.edu> - 2013-03-06 05:59 -0500
  Re: sync databse table based on current directory data without losign previous values Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-06 11:52 +0000
  RE: Set x to  to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64) Wong Wah Meng-R32813 <r32813@freescale.com> - 2013-03-06 12:36 +0000
  Re: sync databse table based on current directory data without losign previous values Chris Angelico <rosuav@gmail.com> - 2013-03-07 00:40 +1100
  Re: sync databse table based on current directory data without losign previous values "Michael Ross" <gmx@ross.cx> - 2013-03-06 15:04 +0100
    Re: sync databse table based on current directory data without losign previous values nagia.retsina@gmail.com - 2013-03-06 08:09 -0800
    Re: sync databse table based on current directory data without losign previous values nagia.retsina@gmail.com - 2013-03-06 08:09 -0800

csiph-web