caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Mismatch between Gc.full_major() documentation and behaviour
@ 2013-12-11 11:46 Bertrand Jeannet
  2013-12-11 13:01 ` Török Edwin
  0 siblings, 1 reply; 2+ messages in thread
From: Bertrand Jeannet @ 2013-12-11 11:46 UTC (permalink / raw)
  To: caml-list

According to the documentation, the sequence 
"Gc.major();Gc.full_major()" should be equivalent to "Gc.full_major()", 
as Gc.full_major() is told to terminate the current major gc and perform 
a complete new cycle.

In my case it is not the case: "Gc.major(); Gc.full_major()" performs 
more calls to finalisation functions than "Gc.full_major()".

My context: I use a weak hashtables containing finalised value (with 
Gc.finalise).

The documentation of Weak module specifies that the finalization 
function is called after the weak hashtbl/array has been set to none.

Does someone know the explanation of this ?



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Mismatch between Gc.full_major() documentation and behaviour
  2013-12-11 11:46 [Caml-list] Mismatch between Gc.full_major() documentation and behaviour Bertrand Jeannet
@ 2013-12-11 13:01 ` Török Edwin
  0 siblings, 0 replies; 2+ messages in thread
From: Török Edwin @ 2013-12-11 13:01 UTC (permalink / raw)
  To: caml-list

On 12/11/2013 01:46 PM, Bertrand Jeannet wrote:
> According to the documentation, the sequence
> "Gc.major();Gc.full_major()" should be equivalent to
> "Gc.full_major()", as Gc.full_major() is told to terminate the
> current major gc and perform a complete new cycle.

They both perform a minor GC cycle too.
So you run a minor cycle twice with 'Gc.major(); Gc.full_major()', but only one with 'Gc.full_major()'.

> 
> In my case it is not the case: "Gc.major(); Gc.full_major()" performs
> more calls to finalisation functions than "Gc.full_major()".
> 
> My context: I use a weak hashtables containing finalised value (with
> Gc.finalise).
> 
> The documentation of Weak module specifies that the finalization
> function is called after the weak hashtbl/array has been set to
> none.
> 
> Does someone know the explanation of this ?

You can run 'Gc.print_stat stderr' to check how many GC minor/major cycles are run in both cases. The number of minor cycles should be different.

Best regards,
--Edwin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-11 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 11:46 [Caml-list] Mismatch between Gc.full_major() documentation and behaviour Bertrand Jeannet
2013-12-11 13:01 ` Török Edwin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).