Python 2.4.3 array memory leak

danmcleran at yahoo.com danmcleran at yahoo.com
Thu May 7 17:31:40 EDT 2009


I am using the array module to instantiate many arrays in my
application. It seems like there is a memory leak in there somewhere.
Can anyone confim this and let me know what, if anything, I can do
about it? I am using Fedora Core 5 Linux:

import commands
import array
import itertools
import sys

from itertools import repeat

print '*** before ***'
print commands.getoutput('cat /proc/meminfo').split('\n')[1]
for i in range(100):
    a = array.array('I', repeat(0, int(2E6)))
    del a
print '*** after ***'
print commands.getoutput('cat /proc/meminfo').split('\n')[1]

Output:
*** before ***
MemFree:       1459772 kB
*** after ***
MemFree:       1457688 kB



More information about the Python-list mailing list