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
On registering values for use in C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-19 (22:30)
From: Robert Roessler <roessler@r...>
Subject: Re: [Caml-list] On registering values for use in C
Nathaniel Gray wrote:
> I have a question about registering values for use in C.  I've read
> that registering lots of values can have a bad effect on GC
> performance, but what about registering "large" values?  For example,
> is registering a record with 20 fields just as bad as registering 10
> records with 2 fields each?

Having implemented "generational" GCs, I can make a generic comment on 
this (without consulting the OCaml sources): as each one of the items 
you register represents a "root" (for our purposes, a tree of items 
which *may* or *may not* not be pointed to by any other item), there 
is a certain amount of per-root overhead that gets amortized over the 
items "marked" (or copied or whatever) during a GC.  This being the 
case, it is likely that your case of "a record with 20 fields" will be 
"less bad" than your case of "10 records with 2 fields each".

Robert Roessler