[Matplotlib-users] Problem of memory leak using FigureCanvasTkAgg

Thomas Caswell tcaswell at gmail.com
Sat Aug 5 19:48:42 EDT 2017


It is likely there things are not being garbage collected due to either a
missed reference surviving or the circular references between the various
objects is delaying gc from collecting them (I do not recall the details
exactly off the top of my head, but running gc manually with more
generations may help).

However, if you are embedding in a GUI you are probably better off just
doing the embedding directly (and skipping `pyplot` entirely, see
https://matplotlib.org/examples/user_interfaces/embedding_in_tk.html ).
Re-using the Figures / Axes / Artists to update the data (rather than
starting from scratch every time) may also prevent the memory leaks _and_
give you a performance boost.

Please subscribe to the list so that you can post without moderation.

Tom

On Sat, Aug 5, 2017 at 12:36 PM GARCIA PIERRE SIMON p0904379 <
pierre.garcia at etu.univ-lyon1.fr> wrote:

> Hello,
>
> I'm PhD student in Bioinformatic and I'm working on a project using
> matplotlib and Tkinter but I've got a big problem of memory leak using
> these modules. I'll be very grateful if you could help me to solve this
> problem. Here is the link explaining what happends, with a reduced script:
>
> http://stackoverflow.com/questions/43097378/matplotlib-vs-tkinter-memory-leak-using-figurecanvastkagg
>
> Thank you in advance,
>
>
> Sincerly,
>
>
>
>
> Pierre Garcia, PhD Student
> ---------
> Bases Moléculaires et Structurales des Systèmes infectieux-UMR5086
> Institut de Biologie et Chimie des Protéines
> 7 passage du Vercors
> 69 367 Lyon cedex 07
> ---------
> Laboratoire de Biométrie et Biologie Evolutive-UMR5558
> UCBL Lyon 1 -Bât. Grégory Mendel
> 43 bd du 11 novembre 1918
> 69622 VILLEURBANNE cedex
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170805/57063920/attachment.html>


More information about the Matplotlib-users mailing list