MATLAB Answers

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

조회 수: 6(최근 30일)
bayran arrieta
bayran arrieta 13 Dec 2017
댓글: Jan 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

  댓글 수: 0

댓글을 달려면 로그인하십시오.

답변(1개)

Jan
Jan 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

bayran arrieta
bayran arrieta 14 Dec 2017
Yes, as you said, I accumulate a lot of graphic elements in the figure. You know that a cnc simulator move a tool trough the axes, and for that to be move you need a series of coordinates,
you can see this video
When the simulation ends, it remains with the high memory until I close the window. starts with 600MB and ends with 700MB, and if I continue without closing the GUI, it is continuing to go up without downloading as long as the tool is moving when I click on play.
Jan
Jan 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.

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by