Skip to content

fix FigureCanvasTkAgg memory leak via weakrefs #25097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

richardsheridan
Copy link
Contributor

PR Summary

Fixes #24820

May be worth checking if the memory leak tests can be tightened.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@tacaswell tacaswell added this to the v3.7.0 milestone Jan 27, 2023
@tacaswell
Copy link
Member

I think it is worth the risk to backport memory-leak fixes.

@tacaswell
Copy link
Member

The flake8 is understood and fixed else where already.

@richardsheridan
Copy link
Contributor Author

This could lead to user breakage since things that were once immortal are now possibly short lived, just like in the original issue.

@richardsheridan
Copy link
Contributor Author

Maybe that was a hasty comment. They should live until someone calls destroy on canvas.get_tk_widget() or its parent, which should be reasonably predictable.

@ksunden
Copy link
Member

ksunden commented Feb 3, 2023

Okay, having convinced myself that these changes work I think it seems fine.

@richardsheridan are you still thinking that things may be too short lived, or was that last comment pretty convinced it is okay?

@richardsheridan
Copy link
Contributor Author

I'm satisfied that those binds won't be released too early from any practical user perspective.

@ksunden ksunden merged commit 472ebaa into matplotlib:main Feb 7, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 7, 2023
@richardsheridan richardsheridan deleted the 24820-figurecanvastkagg-memory-leak branch February 7, 2023 17:40
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FigureCanvasTkAgg memory leak
4 participants