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

5 次查看(过去 30 天)
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

回答(1 个)

Jan
Jan 2017-12-14
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 2017-12-14
编辑:bayran arrieta 2017-12-14
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 2017-12-14
@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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by