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
GC with C issues
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-02-03 (11:16)
From: Olivier Andrieu <andrieu@i...>
Subject: Re: [Caml-list] GC with C issues
 ronniec95@lineone.net [Thu, 3 Feb 2005]:
 > Hello all,
 > I'm looking for some help with the following really short example
 > when I'm trying to reference a C allocated object from Caml (which
 > works fine), but the GC seems to not like it. Here's the sample
 > code - pretty short...


 > I can't see what I'm doing wrong in the allocation? I expect this
 > to leak because I'm not freeing the allocated 'someObject' but I
 > don't expect it to segfault though?

When you use CAMLparam in a function you have to exit it with
CAMLreturn (or CAMLreturn0).

Do not use Store_field on your block: it's an Abstract block, not
traced by the GC, use the Field macro directly :

 Field (retVal, 0) = (value) x;