English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
RE: [Caml-list] nonlinear fit function binding
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-31 (12:23)
Subject: RE: [Caml-list] nonlinear fit function binding
I did a wrapping of the levmar library.


The approach I chose is to allocate bigarrays from Caml, and pass them to the main C function, along with the function f.

In the main function, I register f and all the bigarrays as global roots, and then call as many times the c sub function to compute the minimization.


Feel free to ask for more precisions if needed

Hope this helps.





De : caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.inria.fr] De la part de Matthieu Dubuget
Envoyé : jeudi 31 mai 2007 13:43
À : caml-list@inria.fr
Objet : Re: [Caml-list] nonlinear fit function binding


Well. It seems my former message was unclear?

Here is a more precise question: should/could C allocated bigarrays
 be freed?


OCaml calls one C function M, at about 50 Hz.                                  
In M,  a C function (let's call it A) is locally defined.
One pointer to A is given to another function, that
calls A more than once.

Function A wraps a C array it receives as a parameter
into a bigarray, and give it to OCaml through one callback. 

The whole process is repeated, at about 50 Hz.

I do not know if the bigarrays allocated by M are garbage
collected in any way, and if they are not, how I could free
them in order to avoid any memory leak? 

Thanks in advance


Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. 
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
Societe Generale Asset Management et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. 
Decouvrez l'offre et les services de Societe Generale Asset Management sur le site www.sgam.fr 
This message and any attachments (the "message") are confidential and intended solely for the addressees. 
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration. 
Neither Societe Generale Asset Management nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. 
Find out more about Societe Generale Asset Management's proposal on www.sgam.com