[Scilab-Dev] Gmp in scilab revisited.

Collette Yann ycollet at freesurf.fr
Tue Sep 30 18:47:40 CEST 2008


Good example.
With a pointer stored in a structure: it's the mess.
With a "binary array" stored in a mlist of this kind: 
mlist(['gmplist','array'],[])
it should be better. The memory is managed by scilab, in the array, you 
always allocate a multiple of typeof(double) so as to store your gmp number.
You have to write 2 functions: one to translate a gmp struct into an 
array of double and another to translate an array of double into gmp struct.


What was your strategy ? Do you store gmp numbers into strings ?

YC

Jonathan Blanchard a écrit :
> I see what you mean I think. But what happen when it get destroyed.
> Let say for example the following code.
>
> a = gmpinit(123);
> b = gmpinit(234);
>
> a = gmpmul(a,b);
>
> In this code the initial variable 'a' get cleared but if memory was
> allocated out of the Scilab stack it won't be freed.
>
> Jonathan Blanchard
>
>
>
>   




More information about the dev mailing list