Memory leakage "set" function

조회 수: 1 (최근 30일)
Yavuz kaya
Yavuz kaya 2013년 3월 10일
I am using windows7, and Matlab R2011b.
I have created a GUI, which only contains one pushbutton and one editbox.
In the callback of the pushbutton I have the following script
for i=1:1:1000000
set(handles.edit1,'String',num2str(i))
drawnow
end
When I run the script and hit the pushbutton, the memory rising up to 1GB. I simply use Windows Task Manager to monitor the memory usage.
What cause the memory to rise? what am I missing?
  댓글 수: 2
Matt J
Matt J 2013년 3월 10일
Does the same occur if you omit the "drawnow"?
Daniel Shub
Daniel Shub 2013년 3월 10일
Complete MWE tend to be really helpful. What happens if you do
h = uicontrol('style', 'edit');
for i=1:1:1000000
set(h,'String',num2str(i));
drawnow;
end

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

답변 (1개)

Jan
Jan 2013년 3월 10일
I do not observe a constant growing of the memory occupied by Matlab 2011b/64 under Win7. I've used Daniel's code.
  댓글 수: 1
Daniel Shub
Daniel Shub 2013년 3월 11일
Nor do I under Linux, which is why I asked. Maybe set got overloaded, or more likely there is something else in the loop like a listener

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by