Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-17 Thread Fabrice Silva
Le jeudi 16 juin 2011 à 07:47 -0700, Alain Francés a écrit : Hi Jakob, yes your solution works and is more elegant! See the code at the end of this message. However using the original code with the Agg backend instead of WXAgg also works fine, so there is probably a memory leakage problem

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-17 Thread Alain Francés
Hi, This way the code creates empty images, it needs indeed some update where you inserted the comment. However I'm not sure that the benefit in term of memory and speed will be important. A. PS: I slightly changed the code below since as Jakob noticed: since you just use one figure object and

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-17 Thread Fabrice Silva
Le vendredi 17 juin 2011 à 02:38 -0700, Alain Francés a écrit : Hi, This way the code creates empty images, it needs indeed some update where you inserted the comment. However I'm not sure that the benefit in term of memory and speed will be important. I would think it would avoid creating

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-17 Thread Fabrice Silva
Le vendredi 17 juin 2011 à 12:00 +0200, Fabrice Silva a écrit : Le vendredi 17 juin 2011 à 02:38 -0700, Alain Francés a écrit : Hi, This way the code creates empty images, it needs indeed some update where you inserted the comment. However I'm not sure that the benefit in term of

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-17 Thread Alain Francés
You can in fact remove the fig argument of the plot_density function as it is not used. The clf command removes the children of the figure so that it has to delete the axes and its children (amongst which is the AxesImage) and create new ones when you invoke imshow again. I simply removed

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-17 Thread Fabrice Silva
Le vendredi 17 juin 2011 à 03:49 -0700, Alain Francés a écrit : You can in fact remove the fig argument of the plot_density function as it is not used. The clf command removes the children of the figure so that it has to delete the axes and its children (amongst which is the AxesImage) and

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-17 Thread Alain Francés
By monitoring memory and time with the task manager it looks like there is no big difference. I'm aware that it should be monitored in a more rigourous way but I don't think it is really relevant since the main problem was solved using the Agg backend instead of the WXAgg that seems to have a

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-16 Thread Alain Francés
Hi, http://old.nabble.com/file/p31858795/ErrorMsg.png indeed I forgot to remove these line from previous tests, sorry. However it doesn't affect the code behaviour, the problem remains (it fills the RAM memory and raises a memory error, see img in att.). Alain Davidmh wrote: You are

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-16 Thread Jakob Gager
Hi, I'm not sure if it helps, but you can try to plot always into the same figure object instead of creating a new one every time you call the plot_density function. I would create one figure in advance and pass this the plot_density method. Within the method set the figure active

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-16 Thread Daπid
I can run the script you provided up to 600 without noticing any memory growth (TkAgg backend by default). Using the WxAgg, the memory leak appears. If you don't explicitly need WxAgg, I would recommend using TkAgg, or better Agg if you are not showing the figures. If it is not the case, more

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-16 Thread Alain Francés
Hi, I'm using WXAgg by default because I developped an application with GUI using wxpython. But in this case indeed I don't need WXAgg and substituting WXAgg by Agg just work fine, both in the code I submitted as example (see the corrected code at the end) and in the one I'm working with. So

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-16 Thread Alain Francés
Hi Jakob, yes your solution works and is more elegant! See the code at the end of this message. However using the original code with the Agg backend instead of WXAgg also works fine, so there is probably a memory leakage problem with WXAgg (see the post of David and my reply). Thank for your

[Matplotlib-users] Memory increasing while plotting in loop

2011-06-15 Thread Alain Pascal Frances
Hi, I have a script that creates and saves figures in a loop. The memory is increasing at each figure and is not released back, rising a Memory error. I used the close() function on the figure object as well as gc.collect(), but no effect. I searched on the net and found a similar problem at

Re: [Matplotlib-users] Memory increasing while plotting in loop

2011-06-15 Thread Daπid
You are importing pylab again before each plot. You have loaded it before. for i,t in enumerate(times): import pylab as pl # --ERASE THIS On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances frances17...@itc.nl wrote: Hi, I have a script that creates and saves figures in a loop.