-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: GPU memory leak with plt.figure() #22448
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
Comments
I have no idea how we are leaking to the GPU! That is definitely new. However, I think that this is the same issue we have had with tk with system memory. In Either using
if you never need the GUI windows or making sure you actually show each window to screen before you close it will fix the memory issue. |
Got it, thank you! |
I also believe @richardsheridan has a plan on how to fix this. |
You are probably referring to #22002? @patrickhaoy could you install from that pr and see if it fixes your leak? |
I installed from your maybe_update branch, but the memory leak still occurs. |
Can you try again from #22002, as I think @richardsheridan found an actual big leak with the |
I installed matplotlib from #22002 again, but the memory leak still occurs. |
Thanks for checking. This along with the rss measurement basically confirms we are leaking non-python objects still, but I still can't see from where. I'm looking forward to throwing memray at it. |
I have this memory leak, but in regular old RAM with mpl 3.5.3. |
Bug summary
There seems to be a GPU memory leak when calling
plt.figure()
andplt.close()
repeatedly in matplotlib version3.5.0
. Every time these two lines are ran, more and more GPU memory gets hogged up.Code for reproduction
Actual outcome
When inspecting memory usage, more and more GPU memory gets hogged up. Specifically, I ran
nvidia-smi -l 1
and observed Memory-Usage increasing until it hits the GPU memory limits, which is when the process crashes.Expected outcome
GPU memory usage should not be going up every iteration of this for loop.
Additional information
This is an issue in matplotlib version
3.5.0
, but not3.0.3
.Operating system
Ubuntu
Matplotlib Version
3.5.0
Matplotlib Backend
TkAgg
Python version
3.9.10
Jupyter version
6.4.8
Installation
pip
The text was updated successfully, but these errors were encountered: