Version française
Home     About     Download     Resources     Contact us    
Browse thread
fancy GC question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <mottl@m...>
Subject: Re: fancy GC question
On Tue, 12 Dec 2000, Xavier Leroy wrote:
> It is safe if the C code does not perform any allocation in the Caml
> heap while it is using the "ar" pointer.  An allocation can trigger a
> garbage collection, which can move the Caml block denoted by "v_ar";
> after this, the "ar" pointer no longer points inside the block!

Yes, this should also be avoided. Another problem that comes
to my mind now is that this makes it rather unwise to use the
"enter/leave_blocking_section"-functions when using this trick: another
thread could then trigger a collection while the C-function is still
writing to the array - right?

> > Can other effects mess up the
> > fact that the pointers map continuously on a contiguous chunk of memory
> > (of integers)?
> 
> I'm not sure I understand the question, but the various "fields" of a
> Caml block (as accessed with the Field macro) are always contiguous in
> memory.

Ah, stupid thinking on my side - I get schizophrenic after four o'clock in
the morning and pose several questions in one (everything clear now)... ;)

- Markus

-- 
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl