[Scilab-users] interp and memory

Antoine Monmayrant antoine.monmayrant at laas.fr
Mon Mar 8 10:28:24 CET 2021


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 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memory_leak.png
Type: image/png
Size: 9508 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20210308/1818259b/attachment.png>


More information about the users mailing list