How to check what is holding reference to object

Chris Rebert clp2 at rebertia.com
Tue Apr 27 23:08:36 CEST 2010


On Tue, Apr 27, 2010 at 1:45 PM, Michal M <mich.mierzwa at googlemail.com> wrote:
> I've just found out that one of objects is not destroyed when it
> should be. This means that something was holding reference to this
> object or part of it (i.e. method). Is there any way to check what
> holds that reference? I am unable to do that just looking to the code
> or debugging it because it is pretty complicated, but I am able to
> invoke this situation again.

gc.get_referrers(your_object) ?

Docs: http://docs.python.org/library/gc.html#gc.get_referrers

Cheers,
Chris
--
Thanks for having me learn something new today!
http://blog.rebertia.com



More information about the Python-list mailing list