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


Groups > comp.lang.python > #41566

Re: Wierd behavior of gc.collect

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <amitdev@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'case.': 0.05; 'function,': 0.07; 'python': 0.09; "object's": 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'library': 0.15; 'blocks': 0.16; 'increment': 0.16; 'multiples': 0.16; 'zero,': 0.16; 'wrote:': 0.17; 'circular': 0.17; 'memory': 0.18; 'windows': 0.19; 'written': 0.20; 'info.': 0.22; 'cc:2**0': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'used,': 0.27; 'question': 0.27; "doesn't": 0.28; 'objects': 0.29; "i'm": 0.29; 'that.': 0.30; 'usually': 0.30; 'lists': 0.31; 'running': 0.32; 'certain': 0.33; 'goes': 0.33; 'affects': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'said,': 0.35; 'pm,': 0.35; "won't": 0.35; 'but': 0.36; 'depends': 0.36; 'does': 0.37; 'being': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'release': 0.39; 'where': 0.40; 'free': 0.61; 'back': 0.62; 'necessarily': 0.63; 'different': 0.63; 'times': 0.63; 'here': 0.65; 'gave': 0.65; 'results': 0.65; 'taking': 0.65; 'detail.': 0.65; '2013': 0.84; 'situations,': 0.84; 'verifying': 0.84; 'angel': 0.93
X-Received by 10.50.6.135 with SMTP id b7mr687249iga.9.1363755103152; Tue, 19 Mar 2013 21:51:43 -0700 (PDT)
Newsgroups comp.lang.python
Date Tue, 19 Mar 2013 21:51:42 -0700 (PDT)
In-Reply-To <mailman.3529.1363713205.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=72.163.216.217; posting-account=tKULhwoAAADGQa_90ngAqNBJ-1rg4uyR
References <76cc4613-8086-4b36-a8bd-8ad0f21a19e0@googlegroups.com> <mailman.3525.1363708963.2939.python-list@python.org> <dd31732d-a26f-4a8e-b9d5-0e76bd4c3b55@googlegroups.com> <mailman.3529.1363713205.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 72.163.216.217
MIME-Version 1.0
Subject Re: Wierd behavior of gc.collect
From Bodhi <amitdev@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
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 <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>
Message-ID <mailman.3545.1363755746.2939.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363755746 news.xs4all.nl 6968 [2001:888:2000:d::a6]:34375
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41566

Show key headers only | View raw


Thanks for the info.
I now suspect that the free lists are taking up the memory which won't be released unless we do a collect. I'm verifying that.

On Tuesday, March 19, 2013 10:43:11 PM UTC+5:30, Dave Angel wrote:
> On 03/19/2013 12:36 PM, Bodhi wrote:
> 
> > I know this, but my question is what does gc.collect do which results in the c library to free memory? Usually it is because of unreferenced objects in a cycle or something, but here that doesn't seem to be the case.
> 
> >
> 
> 
> 
> As I said, python calls the C free() function, whether it's when an 
> 
> object's ref-count goes to zero, or whether it's during a gc call, where 
> 
> circular refs are freed.
> 
> 
> 
> But free() does not necessarily release the memory to the OS.  And the 
> 
> times it does depends on which C library is being used, and what OS it's 
> 
> running on.
> 
> 
> 
> If the freed memory affects top in some situations, it's a C library 
> 
> detail.  I've written a replacement C allocator in the past for Windows 
> 
> that used a different scheme for blocks over a certain threshold, and 
> 
> when those blocks were freed, it gave them back to the OS.  But such 
> 
> blocks were multiples of 64k, which was the increment for VirtualAlloc.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> DaveA

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


Thread

Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 08:47 -0700
  Re: Wierd behavior of gc.collect Dave Angel <davea@davea.name> - 2013-03-19 12:02 -0400
    Re: Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 09:36 -0700
      Re: Wierd behavior of gc.collect Dave Angel <davea@davea.name> - 2013-03-19 13:13 -0400
        Re: Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 21:51 -0700
        Re: Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 21:51 -0700
    Re: Wierd behavior of gc.collect Bodhi <amitdev@gmail.com> - 2013-03-19 09:36 -0700

csiph-web