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. |