octave memory leak

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

octave memory leak

Donald Boucher

Greetings,


I am using ubuntu 16.04 and octave 4.2.1. I am having some memory issues when trying to redraw any figure. My memory usage keeps getting larger and larger. It's like octave is making new objects instead of reusing the existing one. When I call delete, the memory usage does not go down. I suspect that this is due to ubuntu's memory management rather than a fault on octave's side.


myBar = waitbar(0, 'testing...');
numBars = 50;
numRepeat = 200;
counter = 0;
for j = 1:numRepeat
  for i = 1:numBars
  msg = sprintf('testing... %d/%d\n%d/%d', i, numBars, j, numRepeat);
  myBar = waitbar(i/numBars, hwbar=myBar, msg);
  counter = counter + 1;
  end
end
delete(myBar);
printf('finished');

Thanks.



-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: octave memory leak

Andreas Weber-6
Am 19.02.2018 um 17:08 schrieb Donald Boucher:

> myBar = waitbar(0, 'testing...');
> numBars = 50;
> numRepeat = 200;
> counter = 0;
> for j = 1:numRepeat
>   for i = 1:numBars
>   msg = sprintf('testing... %d/%d\n%d/%d', i, numBars, j, numRepeat);
>   myBar = waitbar(i/numBars, hwbar=myBar, msg);
>   counter = counter + 1;
>   end
> end
> delete(myBar);
> printf('finished');
>
> Thanks.

You are creating 50 * 200 individual waitbars instead using the
existent. See the example  in "demo waitbar"


 h = waitbar (0, '0.00%');
 for i = 0:0.01:1
   waitbar (i, h, sprintf ('%.2f%%', 100*i));
 endfor
 close (h);


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------