[Scilab-users] interp and memory

Antoine Monmayrant antoine.monmayrant at laas.fr
Mon Mar 8 10:42:05 CET 2021


Hello Jean-Yves,

There is a memory leak, in interp, not splin.
Could you create a bug report?

Antoine

///////

test=%t; // no leak if true, leak if false

niter=100;
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);
   if test then
       d=splin(x,y);
       z=rand(xp);
   else
      d=splin(x,y);
      z=interp(xp,x,y,d);
   end
   mem=evstr(tokens(unix_g('free -b| grep ''Mem:'''))(3));
   mems(i+1)=mem;
   plot(is,mems,'k.');
   if test then
       xs2png(h,"memory_leak_test.png");
   else
       xs2png(h,"memory_leak.png");
   end

end


Le 08/03/2021 à 09:56, Jean-Yves Baudais a écrit :
> Hi,
>
>
>> But I guess splin() gets the derivatives [...]
>
> Oh, maybe I was not clear. The memory issue is not here. There is not 
> problem to compute z. The loop is used to show the problem: it seems 
> that interp doesn't free the used memory after each call. So after 
> hundreds of call Scilab is killed!
>
> 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
>
> --Jean-Yves
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>



More information about the users mailing list