What is consuming physical memory?

Hello,
I have a problem. I have a GUI with three axes and three sliders. At the begining the program is fast but if you move the sliders for a while it becomes slow (it is consuming physical memory). Here it's the code of one of the sliders. ¿Could you please help me to know which is the problem?:
global XsYs;
sliderC=handles.tam(2)-floor(get(handles.sliderCoronal,'Value'))+1;
XsYs(1,1)=sliderC;
XsYs(3,2)=sliderC;
axes(handles.imagencoronal)
imshow(squeeze(handles.VolumenImagen(:,sliderC,:)),[])
axis off
if get(handles.boxcoronal,'Value')
plot([1 handles.tam(3)],[XsYs(2,1) XsYs(2,1)],'Color','y');
plot([XsYs(2,2) XsYs(2,2)],[1 handles.tam(1)],'Color','m');
end
set(gca,'DataAspectRatio',[handles.dataresol(3) handles.dataresol(2) handles.dataresol(1)]);
set(findobj(handles.imagencoronal,'Type','Image'),'ButtonDownFcn','Segmentacion(''buttonDownCallback'',gcbo,[],guidata(gcbf))');
set(handles.textcorteC,'String','Corte','string',sliderC);
delete(findobj(handles.Segmentacion,'Color','g'))
if get(handles.boxaxial,'Value')
plot(handles.imagenaxial,[1 handles.tam(3)],[sliderC sliderC],'Color','g','LineStyle','-');
end
if get(handles.boxsagital,'Value')
plot(handles.imagensagital,[sliderC sliderC],[1 handles.tam(1)],'Color','g','LineStyle','-');
end
clear sliderC;
guidata(handles.Segmentacion,handles)
Thank you

 Respuesta aceptada

Jan
Jan el 24 de Jun. de 2013

0 votos

As far as I can see, you create new picture by imshow() and some plots each time the callback runs. This occupies memory.

Más respuestas (0)

Categorías

Más información sobre Just for fun en Centro de ayuda y File Exchange.

Preguntada:

el 24 de Jun. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by