[Scilab-Dev] Issue with stack in a toolbox

Serge Steer Serge.Steer at inria.fr
Mon May 18 09:27:19 CEST 2009


Vincent Lejeune a écrit :
> Hi,
>
> I am facing another problem in my journey inside the writing of a
> toolbox.
> I need to create a custom type that need to be manipuled with SciLab
> command line. In fact this is a pointer (to a matrix of double stored
> in gpu memory), so I used the CreateVarFromPtr() function to store it
> in the stack.
>
> But when I'm trying to retrieve it afterward, SciLab is complaining
> about a stack overflow, and ask me to change its size. However, this
> is just a lone pointer, it shouldnt eat all the stack by itself...
>
> The code is in attachment. Further investigations shows that the line :
>
> "CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l1);"
here you create a m1*n1 variable in the Scilab stack. So if m1*n1 is big
you may overflow this stack...
CreateVarFromPtr also make a local *copy* of the matrix (not the
pointer) in the stack.

Serge Steer



More information about the dev mailing list