Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] GC and preventing data relocation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christopher Quinn <cq@h...>
Subject: Re: [Caml-list] GC and preventing data relocation
Markus Mottl wrote:
> Since there is no way for me to tell the C-library to continue with a
> new location of the string, I'd like to know whether there is any way
> to prevent the GC from moving specific data?
> 
> Best regards,
> Markus Mottl
> 

i looked into this and came up with:
a) if you have C-heap struct specific to each invocation, register the 
field holding the string pointer as a caml root, deregister it on 
completion. but that is more overhead.

b) add a CString_tag to the set of value tags, modify the compactor() 
routine to take acccount of it, and change the tag of a regular string 
at runtime.
unfortunately this scheme greatly inconveniences the design of the 
compactor and would likely slow it down.

c) differentiate static from dynamic 'chunks' and allocate strings 
from static chunks. this still allows GC to be done on static values 
but is easily integrated into the compactor.
interface: val Cstring.make: int -> string ... as normal.
i have a patch for this if you are interested.

it is all down to the compactor and the current version treats values 
indifferently.

- chris

-------------------
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