ref counting, access from python

Christian Tismer tismer at appliedbiometrics.com
Thu Jun 17 17:12:54 CEST 1999


"Michael P. Reilly" wrote:
> 
> Christian Tismer <tismer at appliedbiometrics.com> wrote:
> 
> : Oleg Orlov wrote:
> :>
> :> Hello.
> :> How can i get objects current ref count from my python code?
> :> Thanks.
> 
> :>>> import sys
> :>>> sys.getrefcount(None)
> : 1583
> :>>> print "ciao - chris"
> : ciao - chris
> :>>>
> 
> Wow, 1583 seems a little high to me. ;)

This was from PythonWin.
If you want to see real weirdness, try IDLE.
Every time you create a window, the number increases.

> Python 1.5.2 (#14, Jun 11 1999, 16:31:09) [C] on aix4
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import sys
> >>> sys.getrefcount(None)
> 140

This is slightly platform dependant.
Under Win98, I get 164 (both with standard and stackless Python).

> Anyone wonder what chris has been doing? ;)

:-) what I do all day - ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     not reilly, oh really




More information about the Python-list mailing list