How to free unreferenced variable inside SciLab stack

Vincent Lejeune vincent.lejeune at institutoptique.fr
Mon May 18 07:18:44 CEST 2009


Hi,

I use a Scilab_variable_pointer in SciLab stack to hold a custom type. The 
matter is that I have no control over its unallocation by the SciLab Stack.
The pointer actually hold the location of a matrix stored on GPU side. But 
when the pointer is no more referenced, the matrix is still in the GPU 
memory, and this lead to dirty memory leaks.
I'm trying to do some benchmark over 10 000 computations of a sum of a 
512*512 matrix. I do this with the SciLab code below :

"timer();for i=1:10000 C=gpuAdd(A,B);end;timer()"

Every time gpuAdd is called, a new matrix is created, but the previous 
matrix is not freed. So I can get up to 10 000 matrix of 250+ ko...
But when I use the same code with "traditionnal" matrix, I don't have any 
memory leak. I think there is some unallocation work done by the scilab 
stacks, I'd like to know if I can overloard it in some way to free Matrix in 
GPU memory when the pointer is freed in the stack.

Thx for the help ! 




More information about the dev mailing list