Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Florian Weimer <fw@d...>
Subject: Re: [Caml-list] Inhibiting heap compaction
* Olivier Andrieu:

>  Florian Weimer [Friday 2 June 2006] :
>  >
>  > Is it possible to prevent the heap from being compacted, 
>
> Yes. cf the function Gc.set
>
>   Gc.set { (Gc.get()) with Gc.max_overhead = max_int }

It looks as if it is possible to modify caml_percent_max directly from
C code.  Hmm.

It would be better if C stack frames could be marked instead.  That
way, the "no compaction, please" would be cleared automatically even
if exceptions are involved.

>  > Currently, I copy all strings used in such a scenario, but this
>  > adds quite a bit of overhead.
>
> Mind that your strings need to be in the major heap for the
> no-heap-compaction approach to work. To ensure this, your strings must
> be long enough or you should call Gc.minor () before calling the C
> function.

I had hoped to use Is_young to see if copying the object is still
necessary but it's not exported by the run-time library.

Well, looks as if I should defer this until copying is truly
unacceptable.