Memory leak in Mac Python IDE ?

Louis M. Pecora pecora at anvil.nrl.navy.mil
Tue Jul 2 13:54:48 EDT 2002


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 PythonMacSIG -- Sorry if you've seen this before]

-- 
-- Lou Pecora
  - My views are my own.



More information about the Python-list mailing list