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
GC question.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] GC question.
On Oct 25, 2005, at 21:20, MATTHEW HAMMER wrote:

> I'm not certain what style of garbage collection is done in the ocaml
> runtime environment,

Generational with two generations, and incremental for the old

> but if its generational for example, I'd like to
> move certain values into the 'oldest' generation, so that the garbage
> collector doesn't waste time on them.

The only way to do that is to call Gc.minor, but it won't save any time.

> The running program in question has a large datastructure that is very
> persistent which takes a lot of GC time if it is transversed too
> often.

If it's large, it's going to be in the major heap anyway.  If you
don't want the GC to traverse it, you'll have to put it outside the
heap, but it might will require a lot of work.  For example, bigarrays
are outside the heap.  Or you could write some C code to build your
structure out of malloc blocks, but I'd count that as a desperate

> So I suppose what I'm asking is: is there a way to give the GC'er
> 'hints' through the Obj module, or any other method?

You can control some parameters with the Gc module, but there's
no way to give hints about a specific piece of data.

-- Damien