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


Groups > comp.lang.python > #41532

Re: Wierd behavior of gc.collect

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.036
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'debug': 0.05; 'python': 0.09; 'malloc': 0.09; 'thread': 0.11; 'expected,': 0.16; 'gc.collect()': 0.16; 'wrote:': 0.17; 'memory': 0.18; 'supposed': 0.21; 'libraries': 0.22; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'setting': 0.26; 'am,': 0.27; '(as': 0.27; 'this.': 0.29; 'maybe': 0.29; 'usually': 0.30; 'returned': 0.30; 'figure': 0.30; 'problem': 0.33; 'to:addr:python-list': 0.33; 'operations': 0.33; "can't": 0.34; 'doing': 0.35; "won't": 0.35; 'there': 0.35; 'but': 0.36; 'operating': 0.36; 'does': 0.37; 'option': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'system.': 0.39; 'to:addr:python.org': 0.39; 'release': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'skip:u 10': 0.60; 'free': 0.61; 'show': 0.63; 'received:74.208': 0.71; 'drops': 0.91
Date Tue, 19 Mar 2013 12:02:27 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3
MIME-Version 1.0
To python-list@python.org
Subject Re: Wierd behavior of gc.collect
References <76cc4613-8086-4b36-a8bd-8ad0f21a19e0@googlegroups.com>
In-Reply-To <76cc4613-8086-4b36-a8bd-8ad0f21a19e0@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:nLlHZXbQJ5/L7D+p2fAhom7YofP8vuGF/FCcGEuHjdS C9YaS9DxCVbWs63/x9ER91Rgu1Sr08/SmUNSle6eQgWtNRSEqD WEfqZ9fTwurjCFVdg8sI42VYQzDIw/eZ2g70wuP27zFHPgrnI5 32Tq2gIZjnuC5j3uR5mgMhjJtgg5wvDSBI518xqfYzQAuhmBw9 DA+2jSdTNkX6pFmYnUUkDIJLMlQOzE+InuDQ9+C2n8JiDddMQm u+kVHKUgpwebPf7cR2JMib993+tt8xzAlv9+u2gxyNAdu9557u ff1RYGeN3JzhN6Y2yghdiYP7W/a1Ho+u4MfTAqn8QLJfFJrbQ= =
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.3525.1363708963.2939.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363708963 news.xs4all.nl 6939 [2001:888:2000:d::a6]:57489
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41532

Show key headers only | View raw


On 03/19/2013 11:47 AM, Bodhi wrote:
> I have a python process that does some operations and is supposed to release memory after those. The issue is that memory is not released (as seen through top). So I do a gc.collect() to see if there is any cycle etc. Immediately after doing the collect memory usage drops as expected, but strangely gc.collect() returns 0.
> This means I cannot find out what the problem is by setting the debug option on gc which is what I usually do to figure out issues like this.
>
> Maybe its that my understanding about it is incorrect, but if gc.collect returned 0, how come some memory was freed?
>

To put it simply, top won't in general show you that things are freed. 
The C libraries for malloc and free will reuse the memory, but not 
usually release it to the operating system.  So it's not usually going 
to show up in 'top.'

There was a long thread on this quite recently, but I can't seem to find 
it right now.


-- 
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