MATLAB Answers

How I clear the memory of a GUI without closing the windows?

2 views (last 30 days)
bayran arrieta
bayran arrieta on 13 Dec 2017
Commented: Jan on 14 Dec 2017
I'm doing a CNC simulator with GUIDE, but after running the simulation, the program remains with a high consumption of RAM, only when it closes and reopens the memory starts to go down again

Answers (1)

Jan
Jan on 14 Dec 2017
It depends on where the memory is consumed. Your current question does not contain any information which would allow to estimate, where how much memory is used. You do not even clarify what "used" means - how do you determine this?
Maybe you store huge data arrays in the ApplicationData (see guidata) or accumulate a lot of graphic elements in the figure, instead of updating the existing ones. Without seeing the code, it is impossible to guess the details.
  2 Comments
Jan
Jan on 14 Dec 2017
@bayran arrieta: Please take the time to read you question and the comment again. Imagine that you do not know anything about what you are doing (as me). Then you might see, that your explanation do not clear any detail: The video does not show, what the program does internally, e.g. where which kind of objects are stored. It does not clear, how you measure the "memory consumption" - but remember that there is no unique or general definition what "consuming memory" exactly means. An application can release memory, which is not immediately usable by other applications - so is this still "consumed" or not?
So please restart this question from scratch: What exactly is your problem? Where are the objects collected, which use the memory? How do you determine the "memory consumption"? How do you try to clear them and why is closing the GUI and reopening it no valid solution already?
In many cases creating a lot of graphic objects is a bad choice, but modifying the XData, YData, ZData of an existing object is much more efficient.
Ask your question such, that the readers get enough information to write an answer. Currently it is not possible to suggest a way to clear the memory, because you do not show us, where it is used.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!