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
Spyder does not realease memory used for matplotlib plots #12847
Comments
Hi @vahid-sb, thanks for the kind words and the reminder. We will keep track of this. Cheers |
@vahid-sb, I have some questions for you (some of which are present in our issue template, so please don't dismiss it for next time):
|
@ccordoba12, for sample code, I am not sure if I can. I mostly encounter it while analysing fMRI data using a library I have developed called
Always inline.
Ubuntu Bionic
I have faced this issue for at least 1.5 years. And I always have all libraries updated to the latest versions, including matplotlib. And I have faced this issue in both Spyder 3 and 4, up to the latest update. So i am pretty sure this is not an issue with only one specific version of matplotlib or spyder. For Qt/PyQt, I am not sure, since I never explicitely use it in my codes. |
Ok, no problem.
Thanks for your answers. I have one last question for you: what is the process that is accumulating memory without releasing it? The kernel or the Spyder interface process? A kernel process appears like |
@vahid-sb, it seems this is a known issue with the inline backend. See here The proposed solution is
Could you try that and let us know if it works for you? That shouldn't fix completely the problem, but it should help a lot to dimish the leakage. |
@ccordoba12 Thanks for letting me know. I will try it, but since these days I work on a completely different problem, it may be a while before I can find some time to run that code. I'd let you know the result as soon as I try this fix. |
@ccordoba12 Other than that, the new spyder is absolutely fantastic. Thanks a lot for all the hard work. |
@je-santos, please read my #12847 (comment) above. The temporary solution is to add Please also let us know if that works for you, so we can start thinking how to include that workaround in our code. |
For me this does not solve the problem. I prepared a simple demonstration code, which I run in spyder 4.1.4 on anaconda. console info: IPython 7.16.1 -- An enhanced Interactive Python.
problem is also present without plt.rcParams['figure.dpi'] = 300 (which increases the resolution of the plots), but uses less memory. If I remove all plots within spyder ide (the three crosses Ctrl-Shift-W) , the memory is not freed. Maybe it is really the images, which use the memory in spyder. A rough calculation suggest: 1000 images used 6.1GB, the size of the images were 1500*1035 which would be 4 bytes per pixel? Thanks a lot for the great IDE, Detlef |
Hi, I have the same issue running miniconda on Linux Mint.
Yes, this is what shows up in my htop and what takes up more and more memory.
This seems to work for my code. |
This is more of a reminder than an issue I hope to see fixed soon. When I run a code that involved plotting and saving hundreds or thousands of matplotlib figures, Spyder causes a memory leak. In spite of all my efforts in closing the figures, using GC library, etc. But if I run the code from the command prompt, the memory leak is not there.
I asked a question about it in Stackoverflow and based on the comment of one of Spyder developers, I understand this is something you have inherited from Jupyter and might not be solved easily. But maybe in future versions, you can keep that issue in mind and find a solution.
I use Spyder for all my work for various reasons. It is the best IDE that I know of. And this issue is its most serious drawback. And that is a real pity.
https://stackoverflow.com/questions/57409470/spyder-does-not-realease-memory-for-matplotlib-plots
The text was updated successfully, but these errors were encountered: