MATLAB Answers


GUI (GUIDE) with images leaking memory

Asked by CAM
on 18 Mar 2019
Latest activity Commented on by CAM
on 19 Mar 2019
Matlab 2018b with GUIDE running on Win 7.
I am programming a GUI that displays small image "thumbnails" from a directory in an axes object. The user selects an image, then presses a button to load said image into a larger axes object for analyses. I am saving the image data and other variables to a series of structures, which I am storing in the main figure using appdata.
My problem is that the GUI is leaking memory. While sitting dormant for 15 minutes, my computer's memory usage increases from 10 GB to 22 GB. The memory usage increases further when I use the GUI -- up to 30GB. At this point, Matlab seems to stall, and I often must close Matlab from the Windows Task Manager to recover the memory. If I am able to close the GUI figure, the memory is NOT returned.
I have researched this issue extensively, and have tried the suggested fixes ("pack" command, "Manage GUI memory" and "Resolve 'Out of Memory' Errors" in the documentation, storing appdata to the Desktop, restarting the computer, etc, etc). None have worked. I don't mind saying that I am very frustrated. Has anyone else had this problem, and how did you fix it?


on 19 Mar 2019
Walter: The cla command did not seem to help. I even changed my original code that steps through the frames of a "movie" file (2-3 seconds long) -- used to call "imshow" with each frame, now I update CData in the image object -- but the problem persists.
The bigger frustration is the leaking memory (and intermittent high CPU usage) when there is no interaction with the GUI. Do I need to reinstall Matlab?
Nothing is coming to mind at the moment .
Do you happen to have any timers running, or any audio input, or any camera input, or any data acquisition sessions ?
on 19 Mar 2019
No timers, inputs nor DAQ sessions.

Sign in to comment.




0 Answers