Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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:23)
From: ronniec95@l...
Subject: Re: [Caml-list] GC with C issues
On Thu, Feb 03, 2005 at 12:16:43PM +0100, Olivier Andrieu wrote:
>  > 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;

Hmm... I thought I was only supposed to do that when using
alloc_small/alloc_shr interface? However using your method does work in
this small example though I'm worried about if something unexpected will
happen in more 'real-life' code...


> -- 
>    Olivier