> > I posted this on maplotlib-users list, but got no reply. I guess that
> > bugs should rather be reported here...
> 
> Could you post a *complete* script that demonstrates the leak, eg one
> that calls the function and does any other cleanup?  Does it help to
> use gc.collect between function calls?

Thanks for your reply. Here is the complete script (I was running the
previous one interactively).
In fact, I realised that the memory leak is not total... I mean that the
RAM gets loaded during the first two iterations, which correspond to a
load of 1.9Gb (I have 4Gb RAM in total). Then the RAM usage remains
absolutely stable. 

I then tried to run this script interactively in ipython. Once the
script ends, the RAM is not released (1.9Gb are still used).
Nevertheless, when I call fa() once again, the memory load remains the
same. So this leak does not lead to a crash, which is fine.

Finally if I comment "matplotlib.use('Agg')", then the load is
increasing during each iteration, saturating the RAM, and starting
filling up the swap. In this case the output of the script is :
9
9
9
9
9

Cheers,
Ben


import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pylab
import gc
def fa():
    a = np.arange(1024**2)
    a = a.reshape(1024,1024)
    for i in range(5):
        filename = "memleak%d" %(i)
        pylab.pcolor(a)
        pylab.savefig(filename)
        pylab.close()
        print gc.collect()
fa()


This outputs:
0
0
0
0
0



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to