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


Groups > comp.lang.python > #68302

Re: What does gc.get_objects() return?

References <lfqcr8$249$1@ger.gmane.org> <5320BD3F.5030509@mrabarnett.plus.com> <lfqjgu$kug$1@ger.gmane.org> <CAPTjJmqdKZ6qDQ+PZAdxVF-hKN=txKh35ga_C451C2z_hpZZAA@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2014-03-12 16:35 -0600
Subject Re: What does gc.get_objects() return?
Newsgroups comp.lang.python
Message-ID <mailman.8107.1394663762.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Mar 12, 2014 at 3:44 PM, Chris Angelico <rosuav@gmail.com> wrote:
> The concept is that the GC tracks (in that sense; everything in
> CPython is refcounted, but that's not what these functions look at)
> anything that could be a part of a reference cycle. That's all it
> concerns itself with, so something that can't have references to
> arbitrary objects can't possibly be worth tracking. Interestingly, a
> tuple of integers is tracked:
>
>>>> a=1,2,3
>>>> gc.is_tracked(a)
> True
>
> So not all optimizations are done that could be done.

Or is it?

>>> a = 1,2,3
>>> gc.is_tracked(a)
True
>>> gc.collect()
0
>>> gc.is_tracked(a)
False

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


Thread

Re: What does gc.get_objects() return? Ian Kelly <ian.g.kelly@gmail.com> - 2014-03-12 16:35 -0600

csiph-web