Memory leak involving matplotlib in webapplication

Hi,

I have problems with a memory leak in a webapplication involving matplotlib. Basically, I have a function which usies the OO way of generating the graph, printing it to a StringIO object and returning that. I’ve posted a question with the details on stackoverflow (http://stackoverflow.com/questions/7740832/need-help-identifying-a-memory-leak-involving-matplotlib-and-flask). Any ideas are highly appreciated.

What version of matplotlib and numpy are you using? Does it help to do:

    import gc
    gc.collect()

after a call to plot total or plot month?

Also, you appear to be adding data to "plot_values" and storing this
on every call. Are you sure the leak is in mpl and not here?
JDH

···

On Thu, Oct 13, 2011 at 12:42 AM, Viktor Forsman <viktor.forsman@...287...> wrote:

Hi,

I have problems with a memory leak in a webapplication involving matplotlib.
Basically, I have a function which usies the OO way of generating the graph,
printing it to a StringIO object and returning that. I've posted a question
with the details on stackoverflow
(http://stackoverflow.com/questions/7740832/need-help-identifying-a-memory-leak-involving-matplotlib-and-flask).
Any ideas are highly appreciated.

I use matplotlib 1.1 and numpy 1.5.0

gc.collect() after the function call solved the problem! Thanks alot!

···

Den torsdagen den 13:e oktober 2011 skrev John Hunter<jdh2358@…878…287…>:

On Thu, Oct 13, 2011 at 12:42 AM, Viktor Forsman > <viktor.forsman@…287…> wrote:

Hi,

I have problems with a memory leak in a webapplication involving matplotlib.
Basically, I have a function which usies the OO way of generating the graph,
printing it to a StringIO object and returning that. I’ve posted a question
with the details on stackoverflow
(http://stackoverflow.com/questions/7740832/need-help-identifying-a-memory-leak-involving-matplotlib-and-flask).
Any ideas are highly appreciated.

What version of matplotlib and numpy are you using? Does it help to do:

import gc
gc.collect()

after a call to plot total or plot month?

Also, you appear to be adding data to “plot_values” and storing this
on every call. Are you sure the leak is in mpl and not here?
JDH