Hello, I am currently writin an algorithm in OCaml. Since its a learning algorithm, I would like to uses some existing code, which is mainly in C. For the program to be usable by others, I write the main structure in C and make call to some functions in Ocaml when needed. Well, I thought I had understood how this works. but obviously, there is omething wrong, for the program crashes, and it seems, according to my tests and sylvain le-gall, that it is due to problem concerning the garbage collector. All I need is this: - say I have an OCaml function psi : int -> float array -> float. - say have a C matrix of data: double ** x_data, and a vector double * y_data. Then, I just need to create, in C a matrix, double ** psi_mat, with values psi m x_i at position m,i, where w_i is the ith row of x_data. One way to do that (not the most efficient) is to create the function psi_c corresponding to the OCaml psi function, and then use it in the code. For instance, let consider this code: -------------------------------------------------------------------- double psi_c(int m, int dim_x,double * x){ int d; CAMLlocal2(val_M,val_x); val_m = Val_int(m); val_x = caml_alloc(dim_x * Double_wosize, Double_array_tag); for(d=0;d