Version française
Home     About     Download     Resources     Contact us    
Browse thread
Stopping and continuing GC
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Stopping and continuing GC
From: Shivkumar Chandrasekaran <shiv@ece.ucsb.edu>

> I noticed that both lablTK and lablGTK turn off GC and recommend  
> using it within callbacks where it is safe. My program consumes tons  
> of memory and I need to continue GC at the start of my callbacks and  
> stop it again as I exit, frequently in the code. Are there any easy /  
> standard Gc.___ calls to do the job "correctly". Thanks in advance,

This looks like a misunderstanding.
You cannot stop the GC in ocaml: it will be triggered as soon as the
young heap is full anyway.
What lablGTK does is turning off compaction, which is a rather new
feature of the GC (didn't exist when lablgtk was first written), which
moves around objects in the old generation, which would break some
assumptions in the code. As indicated, you can still call compaction
explicitly, a simple way being to call Gc.major once in a
while (using a timer for instance), as it will do compaction too when
needed. My understanding is that compaction is atomic, so there is no
notion of starting and stopping it, just of allowing it or not.
I don't remember anything similar in LablTk.

In usual practice, you should not have to do anything special.

Jacques Garrigue