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
Inhibiting heap compaction
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-06-02 (19:55)
From: David MENTRE <dmentre@l...>
Subject: Re: [Caml-list] Inhibiting heap compaction

Florian Weimer <> writes:

> Is it possible to prevent the heap from being compacted, or pin
> individual objects?

You can prevent heap compaction:

   	mutable max_overhead : int; (* Heap compaction is triggered when
   	               the estimated amount of "wasted" memory is more
   	               than max_overhead percent of the amount of live
   	               data. If max_overhead is set to 0, heap
   	               compaction is triggered at the end of each major
   	               GC cycle (this setting is intended for testing
   	               purposes only). If max_overhead >= 1000000,
   	               compaction is never triggered. Default: 500. *)

Use Gc.set to change those parameters.

Best wishes,

PS: I think Lablgtk prevent heap compaction for similar reasons.
pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A