Problem of memory leak using FigureCanvasTkAgg

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem of memory leak using FigureCanvasTkAgg

GARCIA PIERRE SIMON p0904379
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:

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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem of memory leak using FigureCanvasTkAgg

tcaswell
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 <[hidden email]> 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:

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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem of memory leak using FigureCanvasTkAgg

Benjamin Root
The stackoverflow posting notes that mpl v1.1.1 was used, which is 5 years old. I am pretty sure we have made a lot of memory leak fixes since then. I noted as such on SO.

Ben Root

On Sat, Aug 5, 2017 at 7:48 PM, Thomas Caswell <[hidden email]> wrote:
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 <[hidden email]> 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:

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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users



_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users