[Scilab-users] interp and memory
Stéphane Mottelet
stephane.mottelet at utc.fr
Mon Mar 8 11:52:38 CET 2021
It has been fixed by Antoine some minutes ago:
https://codereview.scilab.org/#/c/21708/
S.
Le 08/03/2021 à 10:42, Antoine Monmayrant a écrit :
> 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
>> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
>>
>>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
>
--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
More information about the users
mailing list