What does gc.get_objects() return?
jurko.gospodnetic at pke.hr
Wed Mar 12 22:28:13 CET 2014
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.
More information about the Python-list