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
[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: 2003-03-21 (00:01)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] GC and preventing data relocation
On Thu, 20 Mar 2003, Christopher Quinn wrote:
> 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.

I don't quite understand this solution. How should this prevent the
string from being relocated if the string was allocated in the OCaml-heap?

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

And wouldn't be particulary portable...

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

This solution is also not portable and inconvenient for the user,
because he has to allocate strings in this specific way.

Hm, seems we are out of luck here?

Markus Mottl

Markus Mottl                                   
Austrian Research Institute
for Artificial Intelligence        

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: