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
How to re-implement the GC?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-09-13 (12:23)
From: Sylvain Le Gall <sylvain@l...>
Subject: Re: How to re-implement the GC?
On 13-09-2010, Eray Ozkural <> wrote:
>> On 13-09-2010, Eray Ozkural <> wrote:
>> > Hi there,
>> >
>> > What exactly are the requirements for substituting the current GC with
>> > another, preferably non-locking, GC? Any pitfalls I wouldn't see just
>> > reading the code?
>> >
>> The GC is deeply interacting with the the rest of the compiler. I think
>> you will spend a lot of time on this task.
> Deeply interacting with the compiler, how? Not through the public interface
> of GC? Do you mean it is not used in a clean way?

I am not sure how you define "clean way". I think it is very efficient,
but not "modular or object-oriented". I would say that it is clean with
regard of the efficiency. But I won't use it to demonstrate how GC works
to student (but I won't either show them real world implementation of
other GC which are always more complex when optimization is required).

AFAIK, it uses some machine register to store a pointer to the minor
heap. But I am not a GC expert. 

>> I would recommend you trying OC4MC, which is probably what you are
>> looking for:
> Yes, I've seen it but it's a work in progress, and it's being rewritten from
> scratch.

If you stick to 3.11.1 OCaml version, you'll be able to compile with one
of their latest "stable" patch. 

To be honest, I think that if you join your efforts with theirs, you'll
probably get something quicker than going alone on this path. But this
is only my opinion.

At least, you will need the "fully-reentrant" runtime they are doing. 

>> They show quite interesting results using Thread at the last OCaml
>> Meeting, though they are still some bugs (almost linear speed-up with
>> multicore).
> What exactly is the GC being used there? Is it a custom algorithm or a known
> one? Could we plug our own algorithm to the oc4mc if it has already provided
> the basic changes to substitute the GC?

I think you won't be able to plugin your own GC. The one they provide is
a "stop the world"... I am not sure though, ask them directly.

Sylvain Le Gall