magic memory leak, Python or Windows problem?

Marcus Stojek stojek at part-gmbh.de
Fri May 2 05:38:21 EDT 2003


Hi,
Im using Python 2.2 with Windows NT. After hunting a 'memory leak' for
a couple of days my code is down to the following lines:
#------------------------
cont =1
while cont:
    lile = int(raw_input('listsize: '))
    li=[]
    for i in range(lile):
        li.append(5.0)
    stop = raw_input('press ENTER do delete list')
    del li
    wait = raw_input('again ?   ')
    if wait[0] not in ['y','Y']:
        cont=0
#------------------------
I am checking the memory usage of my prog with the Task-Manager Tool
of NT. Starting the prog shows a memory usage of app. 2,200 KB. When
generating a list of 2,000,000 floats mem increases to 34,900 KB. 

Now, when deleting the list, the memory usage comes down to 27,000 KB.
Where did the remaining 25,000 KB go?

Repeating this procedure a second or third time, again ends up with
27,000 KB of mem usage. Only if I increase the size of my list, the 
memory usage after deleting the list increases.

Can anybody explain this? Is this a problem of Pyhon or of what the
Task Manager shows (or maybe of my brain)?

Thanks,
Marcus




More information about the Python-list mailing list