From: Ferry on 13 Aug 2010 07:06 Hi again, I discovered an interesting thing with this. I stripped down the whole code and came up with the following. The following code doesn't produce the memory leak: figure; data.handle = image(rand(1021,724,3)); for k = 1:250 set(data.handle,'Cdata',rand(1021,724,3)); drawnow; end But I forgot that in the gui, the image is placed on a surface. So by doing this: figure; A = rand(1021,724,3); data.handle=surface([-1 1;-1 1],[1 1;-1 -1],ones(2),A,'facecolor','texturemap','edgecolor',[0 0 0],'linewidth',3,'cdatamapping','scaled'); for k = 1:250 set(data.handle,'Cdata',rand(1021,724,3)); drawnow; end The memory leak is there! Both codes display a figure window with random images flashing by, but the memory leak occurs only in the code with the surface in it. So apperently I'm doing something wrong with apllying Cdata to surfaces. Hope this is clear enough to help me out! Ferry
From: Bruno Luong on 13 Aug 2010 07:48 "Ferry " <frietje44(a)hotmail.com> wrote in message <i438v0$osb$1(a)fred.mathworks.com>... > Hi again, > > I discovered an interesting thing with this. I stripped down the whole code and came up with the following. > The following code doesn't produce the memory leak: > > figure; > data.handle = image(rand(1021,724,3)); > for k = 1:250 > set(data.handle,'Cdata',rand(1021,724,3)); > drawnow; > end > > But I forgot that in the gui, the image is placed on a surface. So by doing this: > > figure; > A = rand(1021,724,3); > data.handle=surface([-1 1;-1 1],[1 1;-1 -1],ones(2),A,'facecolor','texturemap','edgecolor',[0 0 0],'linewidth',3,'cdatamapping','scaled'); > for k = 1:250 > set(data.handle,'Cdata',rand(1021,724,3)); > drawnow; > end > > The memory leak is there! > Both codes display a figure window with random images flashing by, but the memory leak occurs only in the code with the surface in it. So apperently I'm doing something wrong with apllying Cdata to surfaces. Interesting, I wouldn't expect that the memory is leaking by SET(). It looks like a bug to me. Bruno
First
|
Prev
|
Pages: 1 2 3 Prev: solving linear equations with constraints Next: stepper motor 1/16 microstepping |