[Python-Dev] Unexpected increase of globals() refcount
Chandra Srinivasan
Chandra.Srinivasan at synopsys.com
Fri May 23 17:49:31 CEST 2014
More information about the Python-Dev mailing list
Fri May 23 17:49:31 CEST 2014
- Previous message: [Python-Dev] [python-committers] [RELEASED] Python 3.4.1
- Next message: [Python-Dev] Unexpected increase of globals() refcount
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I ran the following code in the Python interpreter and am trying to determine if the behavior I see is expected:
import sys
print sys.getrefcount(globals())
class Foo(object):
def __init__(self):
pass
print sys.getrefcount(globals())
The first print statement above prints '4' and the second one prints '5'. However, if I remove the __init__ method from the class, the refcount stays the same.
If I change the above code like this, the ref count stays the same:
import gc
import sys
print sys.getrefcount(globals())
class Foo(object):
def __init__(self):
pass
del Foo
while gc.collect():
pass
print sys.getrefcount(globals())
Can you let me know if this is a bug in the Python interpreter?
-Chandra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140523/d6ee9a18/attachment.html>
- Previous message: [Python-Dev] [python-committers] [RELEASED] Python 3.4.1
- Next message: [Python-Dev] Unexpected increase of globals() refcount
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list