[Python-bugs-list] [ python-Bugs-489669 ] memory leak in test_descr (unicode)

noreply@sourceforge.net noreply@sourceforge.net
Thu, 06 Dec 2001 12:04:25 -0800


Bugs item #489669, was opened at 2001-12-05 18:40
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=489669&group_id=5470

Category: Python Interpreter Core
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
Assigned to: Guido van Rossum (gvanrossum)
Summary: memory leak in test_descr (unicode)

Initial Comment:
leak from unicode object when running test_descr
may be related to bug "memory leak in test_unicode"

see attached file for details

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-06 12:04

Message:
Logged In: YES 
user_id=6380

Thanks, Marc-Andre! That was it. Fixed in unicodeobject.c
rev. 2.124.

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

Comment By: M.-A. Lemburg (lemburg)
Date: 2001-12-06 08:43

Message:
Logged In: YES 
user_id=38388

Could be the PyUnicode_CheckExact() test in unicode_dealloc() which is triggering this behaviour. It seems that 
for subclassed types, there is no chance for the various DECREFs in that code to get executed.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-06 08:26

Message:
Logged In: YES 
user_id=6380

If we call the constructor like U(u"xxxxxxxxxx") instead, it
leaks faster. With a really large unicode string argument,
it leaks fenomenally fast. Using debug mode and printing the
remaining objects at the end by setting $PYTHONDUMPREFS=y
doesn't reveal any leaked objects. So it's leaking a copy of
the Unicode data. I'll look into it.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-06 08:12

Message:
Logged In: YES 
user_id=6380

This is still there.  The leak is in buffer_inherit(). It
can be reduced to:

| while 1:
|     class U(unicode):
|         pass
|     U()


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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-06 06:11

Message:
Logged In: YES 
user_id=6380

I may or may not have fixed this through plugging a leak in
ceval.c.

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

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