referrers

raghu raghavan.viswanathan at wipro.com
Wed May 24 06:11:02 EDT 2006


Diez,

I did look into gc, specifically gc.get_referrers(), but it seemed to
give me something that I cant decipher.

I added the following line.

print "referrers ",gc.get_referrers(x0)

This is what I got.

referrers  [{'__builtins__': <module '__builtin__' (built-in)>,
'__file__': './tst1.py', 'pdb': <module 'pdb' from
'/home/raghavan/Python-2.4/my_install/lib/python2.4/pdb.pyc'>, 'sys':
<module 'sys' (built-in)>, 'y': 24012, 'gc': <module 'gc' (built-in)>,
'myfuncs': <module 'myfuncs' from '/home/Raghavan/tst/myfuncs.dll'>,
'__name__': '__main__', 'x0': 24012, 'z': 24012, 'os': <module 'os'
from '/home/raghavan/Python-2.4/my_install/lib/python2.4/os.pyc'>,
'__doc__': None, 'types': <module 'types' from
'/home/raghavan/Python-2.4/my_install/lib/python2.4/types.pyc'>},
(None, '/home/Raghavan/tst', 'my pid is ', 24012, 'ref count ',
'referrers ')]

Also the len of this is 2, while I got refcount=5. So I dont know
whether this can be used in the same way.

Thanks.

Bye,
Raghavan V




More information about the Python-list mailing list