Python memory deallocate

bruno at modulix onurb at xiludom.gro
Thu May 11 10:10:15 EDT 2006


mariano.difelice at gmail.com wrote:
> Ok, this is true.
> 
> Well, you consider that my app has a first windows, where I choose, for
> example, the application 1.
> The application 1 will be started, and it will allocate 200Mb total.
> Now I want to abort this operation, and i will return  to main initial
> window. The memory usage remain to 200Mb, even if I've destroyed the
> application 1 object with app1.Destroy() and del app1.
> When from initial windows i re-choose application1, the memory usage
> don't stay to 200Mb, but will increase to 360-380Mb memory, and I think
> this  is not good!!!
> 
> If I will repeat this procedure for 5-6 times, the application will
> crash...

Either there are references somewhere keeping some objects alive, or
you're facing a known problem with pymalloc() [1]. In the second case,
the good news is that this problem seems to be solved in Python 2.5 [2].
The bad news is that Python 2.5 is still alpha...

Just a question: do you really need your app to be monolithic ? If
you're application is really composed of many applications (which is
what I understand from your example), you should probably have many
distinct applications, one of them being in charge of running the
others. This way, 'aborting' an app would kill the corresponding
process, and free memory.


[1] or it's yet another problem, of course - CS wouldn't be that fun if
it was so simple :(

[2] http://docs.python.org/dev/whatsnew/section-other.html

My 2 cents

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list