[issue9366] Reference leak for local new style class

Kay Hayen report at bugs.python.org
Sat Jul 24 11:46:41 CEST 2010


New submission from Kay Hayen <kayhayen at gmx.de>:

Hello,

I have created tests that check the reference counting and found that the following simple function leaks references in CPython:

def simpleFunction39():
   class Parent( object ):
      pass

I have attached a test that needs to be run with python-dbg and checks the total reference count for many language constructs. Sometimes a warmup can be useful, if CPython caches something, but it doesn't help in this case. Removing object or replacing it with an old style class helps.

I think I saw that 3 references of object leak, and a total of ca. 20 for each call to the function. I suspect a memory leak too.

Use the attached file for reproduction of the problem.

----------
components: Interpreter Core
files: Referencing.py
messages: 111433
nosy: kayhayen
priority: normal
severity: normal
status: open
title: Reference leak for local new style class
type: resource usage
versions: Python 2.6
Added file: http://bugs.python.org/file18173/Referencing.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9366>
_______________________________________


More information about the Python-bugs-list mailing list