caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
To: Tiphaine Turpin <Tiphaine.Turpin@irisa.fr>
Cc: Sylvain Le Gall <sylvain@le-gall.net>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: Mastering the garbage collector
Date: Thu, 25 Jun 2009 20:12:50 +0200	[thread overview]
Message-ID: <4A43BE22.1080802@univ-savoie.fr> (raw)
In-Reply-To: <4A4399A2.2090301@irisa.fr>


[-- Attachment #1.1: Type: text/plain, Size: 1955 bytes --]

Tiphaine Turpin a écrit :
> Sylvain Le Gall a écrit :
>   
>> You need to do a "Gc.compact" to size down. A full_major will collect but I
>> am not sure it will free allocated page.
>>   
>>     
> But if it is just a matter of compaction, then
>
> (Gc.stat ()).Gc.live_words
>
> should give me a correct (small) result, no ?
>
> Tiphaine
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>   
You need to make sure that a complete GC cycle has run after producing
your result, before

(Gc.stat ()).Gc.live_words gives you what you want.

The function you need is that one :

val full_major : unit -> unit

Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This 
will collect all currently unreachable blocks.

You should make sure that variables with values holding large objects
are not syntactically in the scope of any piece of code that can still
be evaluated (I am not sure I am very clear). Here is a small example :


let x = ... in
(* here you are not sure x is collected even if the variable does not
appear after this comment *)
let y = 3 in
...


Cheers,
Christophe

-- 
Christophe Raffalli
Universite de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tel: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution 
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------


[-- Attachment #1.2: Christophe_Raffalli.vcf --]
[-- Type: text/x-vcard, Size: 310 bytes --]

begin:vcard
fn:Christophe Raffalli
n:Raffalli;Christophe
org:LAMA (UMR 5127)
email;internet:christophe.raffalli@univ-savoie.fr
title;quoted-printable:Ma=C3=AEtre de conf=C3=A9rences
tel;work:+33 4 79 75 81 03
note:http://www.lama.univ-savoie.fr/~raffalli
x-mozilla-html:TRUE
version:2.1
end:vcard


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

  reply	other threads:[~2009-06-25 18:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-25 14:57 Tiphaine Turpin
2009-06-25 15:14 ` Sylvain Le Gall
2009-06-25 15:37   ` [Caml-list] " Tiphaine Turpin
2009-06-25 18:12     ` Christophe Raffalli [this message]
2009-06-26  7:28       ` Tiphaine Turpin
2009-06-27  7:51         ` Christophe Raffalli
2009-06-25 15:53 ` [Caml-list] " Julien Signoles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A43BE22.1080802@univ-savoie.fr \
    --to=christophe.raffalli@univ-savoie.fr \
    --cc=Tiphaine.Turpin@irisa.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=sylvain@le-gall.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).