Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Question about register_global_root
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Florian Douetteau <Florian.Douetteau@e...>
Subject: Re: [Caml-list] Question about register_global_root


As far as i understand the caml gc, it only scans blocks pointing to memory
blocks allocated through caml allocation functions
The reason of this is to allow pointers C values allocated C heap to be
pointed directly by caml values
(As shown in the unix-curses exemple at
http://caml.inria.fr/ocaml/htmlman/manual032.html#htoc224)

if you try to allocate C values in C malloc heap, it just won't work (your C
values won't be scanned, and those allocated in the original caml heap
only pointed by your caml values in C heap, will be reclaimed too soon)

Hope this helps ...


----- Original Message ----- 
From: "Mary F. Fernandez" <mff@research.att.com>
To: <caml-list@inria.fr>; "Jerome Simeon" <simeon@research.bell-labs.com>
Sent: Wednesday, May 28, 2003 9:45 PM
Subject: [Caml-list] Question about register_global_root


> Hi Caml experts,
> We are using register_global_root to register addresses in the malloc'd
> C heap that contain Caml values.  We noticed that register_global_root
> (comment below) expects a global C variable, but we assumed that it should
> work with malloc'd addresses as well.  Is there any reason that it would
not?
>
> /* [register_global_root] registers a global C variable as a memory root
>     for the duration of the program, or until [remove_global_root] is
>     called. */
>
> We are getting (somewhat random) core dumps after calling the same Caml
> function repeatedly on the same Caml value (which is referenced
> from the C heap).
>
> Thanks,
> Mary
> -- 
> Mary Fernandez, Principal Technical Staff Member
> AT&T Labs - Research, 180 Park Ave., Room E243, Florham Park, NJ
07932-0971
> phone: 973-360-8679,  fax: 973-360-8187
> mff@research.att.com, http://www.research.att.com/~mff
>
>
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives:
http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ:
http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners