[Python-bugs-list] [ python-Bugs-782369 ] Massive memory leak in array module

SourceForge.net noreply@sourceforge.net
Sun, 03 Aug 2003 10:50:01 -0700


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

Category: Extension Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: Massive memory leak in array module

Initial Comment:
Simplified variant of a test program from c.l.py:

.import array
.
.def test():    
.    for x in xrange(1000000):
.        b = array.array('B', range(120, 120+64))
.
.test()

On Win98 under 2.3, it zooms to 200MB in a few 
seconds.  No growth under 2.2.3 (it stays under 2MB 
until it finishes).

Problem goes away if

.        b = range(120, 120+64)

instead.  Problem also goes away if

.        b = array.array('B', range(64))

instead.  I expect (but ave  not confirmed) that in the 
latter cases it's leaking refcounts (to the immortal "little 
integers").

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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-08-03 13:50

Message:
Logged In: YES 
user_id=33168

I think the problem may be due to the change on line 1760 of
arraymodule from PyList_GetItem (2.2) to PySequence_GetItem
(2.3) in 2.88 by Raymond.  

Adding a Py_XDECREF(v) at line 1765 "fixes" the problem, but
I don't think that's necessarily the correct solution for
all types.

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

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