English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
GC question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-07-06 (07:29)
From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@l...>
Subject: Re: [Caml-list] GC question

dmitry grebeniuk writes:
 >   I have some objects (custom blocks with method suite attached)
 > which can be referenced from caml heap.  How to ensure that
 > finalisation function is called for all non-referenced objects?
 > I know, call to caml_gc_full_major(Val_unit) will do this work,
 > but it can be costly when there are many values on the heap
 > (or not?).  Are there any quicker solution?  (I can make no
 > assumptions about "age" (young/old) of allocated custom blocks
 > and about current GC state)

The two integer parameters "used" and "max" passed to alloc_custom are
controlling how fast the custom blocks are reclaimed by the GC, as
explained in section 18.9.2 of the manual
(see http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html).

I don't think that calling caml_gc_full_major by yourself is a good
idea. You should trust the GC; it will eventually reclaim any block
that is not referenced anymore.

Hope this helps,