Hello Jean-Yves,

Yes, you are right, it does look like a memory leak: the memory increases linearly with the number of iterations (see attached file and modified script below). But keep in mind that the plot might integrate some growing overhead due to the plotting...

Antoine

/////////

niter=1000;
mems=zeros(1:niter+1)*%nan;
is=0:niter;

h=scf();
mem=evstr(tokens(unix_g('free -b| grep ''Mem:'''))(3));
mems(1)=mem;
plot(is,mems,'k.');
xlabel('iteration of splin/interp')
ylabel('memory used')
for i=1:niter
  mprintf("%d\n",i);
  n=1e6;
  xp=1:n;
  x=1:100:n;
  y=rand(x);
  d=splin(x,y);
  z=interp(xp,x,y,d);
  mem=evstr(tokens(unix_g('free -b| grep ''Mem:'''))(3));
  mems(i+1)=mem;
  plot(is,mems,'k.');
  xs2png(h,"memory_leak.png");
end


Le 08/03/2021 à 09:56, Jean-Yves Baudais a écrit :
for i=1:1000
  mprintf("%d\n",i);
  n=1e6;
  xp=1:n;
  x=1:100:n;
  y=rand(x);
  d=splin(x,y);
  z=interp(xp,x,y,d);
end
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to