[Python-bugs-list] [ python-Bugs-708806 ] memory leak in nested def()

SourceForge.net noreply@sourceforge.net
Mon, 24 Mar 2003 09:58:09 -0800


Bugs item #708806, was opened at 2003-03-24 08:42
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=708806&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Christian Tismer (tismer)
>Assigned to: Tim Peters (tim_one)
Summary: memory leak in nested def()

Initial Comment:
I just tested generators and found a memory leak.
(Has nothing to do with generators).
The following code adds one to the overall refcount
and gc cannot reclaim it.

def conjoin(gs):
     def gen():
         gs      # unbreakable cycle
         gen     # unless one is commented out

The above holds for Python 2.2.2 upto the current CVS
version. I didn't try yet to investigate this further.

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

>Comment By: Tim Peters (tim_one)
Date: 2003-03-24 12:58

Message:
Logged In: YES 
user_id=31435

Fixed.  The compiler was leaking a reference to the int 0, 
used to index an internal list.

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

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