Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'cpython': 0.05; 'interpreter': 0.05; 'mrab': 0.05; 'instances.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'question.': 0.14; 'object()': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'not,': 0.20; 'header:User-Agent:1': 0.23; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'them?': 0.31; 'class': 0.32; 'thanks!': 0.32; 'charge': 0.33; 'guess': 0.33; 'raw': 0.33; 'could': 0.34; 'objects': 0.35; 'instances': 0.36; 'thanks': 0.36; 'subject:?': 0.36; 'detail': 0.37; 'list': 0.37; 'to:addr:python-list': 0.38; 'explain': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'from:charset:utf-8': 0.61; 'such': 0.63; 'more': 0.64; 'received:46': 0.66; 'detail.': 0.68; 'hand': 0.80; '3.4': 0.84; 'atomic': 0.84; 'subject:skip:g 10': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: =?UTF-8?B?SnVya28gR29zcG9kbmV0acSH?= Subject: Re: What does gc.get_objects() return? Date: Wed, 12 Mar 2014 22:28:13 +0100 Organization: PKE sistemi d.o.o. References: <5320BD3F.5030509@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 46.188.175.241 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <5320BD3F.5030509@mrabarnett.plus.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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394659708 news.xs4all.nl 2914 [2001:888:2000:d::a6]:40154 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68298 Hi. On 12.3.2014. 21:02, MRAB wrote: >> I was wondering if someone could explain gc.get_objects() in a bit >> more detail to me. >> >> Does it return a list of 'all objects known to Python'? Only some of >> them? Which does it return? Which it does not? >> > > gc.is_tracked(...) might be relevant to your question. Thanks! The documentation for gc.is_tracked() straightened me out. :-) So gc.collect() returns a list of all the objects GC is in charge of, and which instances are and are not tracked by the GC is, I guess, an interpreter implementation detail. For CPython 3.4 I guess strings and other atomic types such as ints are not, as well as raw object() instances. Custom class instances on the other hand seem to be under GC control. Thanks again. Best regards, Jurko Gospodnetić