[Python-bugs-list] [ python-Bugs-735247 ] Memory leak concerning super and staticmethod

SourceForge.net noreply@sourceforge.net
Fri, 09 May 2003 11:30:31 -0700


Bugs item #735247, was opened at 2003-05-09 14:08
Message generated for change (Comment added) made by jhylton
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=735247&group_id=5470

Category: Python Interpreter Core
Group: Python 2.2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Steve Alexander (stevea_zope)
Assigned to: Jeremy Hylton (jhylton)
Summary: Memory leak concerning super and staticmethod

Initial Comment:
    def test_leak(self):
        # XXX Leaky. This is the same leak as in
test_subclass_constructor,
        #     but isolated to depend only on code in
Python 2.2.2.
        #     It still leaks on the release22-maint
branch, but not with
        #     Python 2.3 from CVS HEAD.
        class SomeClass(object):
            def somemethod():
                # XXX The next line produces the
following leak:
                #
                # totalrefcount=233207   change=32
                # <type 'tuple'>                3       12
                # <type 'type'>                 1        7
                # <type 'dict'>                 1        5
                # <type 'staticmethod'>         1        4
                # <type 'function'>             1        4
                # <type 'getset_descriptor'>    1        4
                # <type 'member_descriptor'>    1        4
                # <type 'cell'>                 1        4
                # <type 'weakref'>              1        4
                # <type 'str'>                  0       10
                # <type 'class'>                0        1
                # <type 'code'>                 0        1

                super(SomeClass, None)
            somemethod = staticmethod(somemethod)
        SomeClass.somemethod()

The above was taken from Zope 3 CVS.

http://cvs.zope.org/Zope3/src/zope/proxy/tests/test_proxy.py.diff?r1=1.6&r2=1.7



----------------------------------------------------------------------

>Comment By: Jeremy Hylton (jhylton)
Date: 2003-05-09 18:30

Message:
Logged In: YES 
user_id=31392

Fixed in 
rev 2.73.2.1.2.5 of Modules/cPickle.c
rev 2.50.4.2 of Objects/funcobject.c


----------------------------------------------------------------------

Comment By: Steve Alexander (stevea_zope)
Date: 2003-05-09 17:03

Message:
Logged In: YES 
user_id=492001

This is a bug report against Python 2.2.2, and the Python
2.2 maintenance branch in CVS.
I'd like to see this fixed for Python 2.2.3, as it will stop
a Zope 3 test from leaking.
The obvious way to fix it is to backport stuff from Python 2.3.


----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2003-05-09 16:40

Message:
Logged In: YES 
user_id=31392

steve: is this bug report just a reminder to backport this
fixes from 2.3?


----------------------------------------------------------------------

Comment By: Steve Alexander (stevea_zope)
Date: 2003-05-09 14:10

Message:
Logged In: YES 
user_id=492001

Darn, the formatting isn't preserved.

Look at the HTTP link at the bottom. The method in question
is all that changed in the diff highlighted.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=735247&group_id=5470