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
Using the C FFI to wrap an OCaml library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-09 (04:07)
From: Jonathan Bryant <jtbryant@v...>
Subject: Re: [Caml-list] Using the C FFI to wrap an OCaml library
On Fri, Feb 8, 2008 at 4:53 PM, Joel Stanley <> wrote:

> Well, much of my curiosity stems from the fact that I know little about
> the OCaml runtime or how the OCaml GC is invoked.  If the GC can ever be
> invoked in its own thread, it seems like while the values (of type
> 'value') are being passed back on the stack (but *after* the
> caml__local_roots pointer has been reverted) there could be problems?
> If this can't ever happen, great! Why not?
I believe GC cycles can only be kicked off by an allocation since this is
the only time that any memory would need to be recovered, so this could
never happen.  As I understand it, any GC cycles would start and complete
within the call to the allocation function.  Multi threaded code might be an
exception, because there could be a context switch and a GC triggered by
another thread at just the wrong moment.