[Pythonmac-SIG] Memory Leak in Python 2.2 IDE on Mac?

Louis M. Pecora pecora@anvil.nrl.navy.mil
Tue, 2 Jul 2002 13:55:55 -0400


I run the following code in a file under the IDE (under System 9.1 on a G4 Mac with 40 MB allocated to Python 2.2 IDE):

#--Test code

from Numeric import *

tab1=zeros((200000,4))
print shape(tab1)

#--End Test code

Check the memory under 'About this Computer' in the Finder.

Then change tab1 to tab2 and run again (I hit cmd-R several times quickly and that seems to worsen the problem - don't know why), then check memory and see that more is used up.  Continue this process to tab3, tab4, etc. and eventually I get an exception -- ran out of memory, cannot allocate more.  Sure enough, under 'About this Computer' in the Finder, the memory is used up.

Looks like a memory leak to me, but maybe the IDE is set up to keep variables around, hence tab1, tab2, etc. are never garbage collected after the module is run with a new varible name, e.g. tab2 in place of tab1.

Anyone know?

[Also posted to comp.lang.python -- Sorry if you've seen this before]

-- 

Cheers,

Lou Pecora