From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 1BAAFBBAF for ; Thu, 25 Jun 2009 20:13:06 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvUBAAtbQ0rUGyoBkWdsb2JhbACBUYxsijgBAQEBCQsKBxMDuVaEDQU X-IronPort-AV: E=Sophos;i="4.42,292,1243807200"; d="asc'?vcf'?scan'208";a="30180256" Received: from smtp1-g21.free.fr ([212.27.42.1]) by mail3-smtp-sop.national.inria.fr with ESMTP; 25 Jun 2009 20:13:04 +0200 Received: from smtp1-g21.free.fr (localhost [127.0.0.1]) by smtp1-g21.free.fr (Postfix) with ESMTP id C4D0294018F; Thu, 25 Jun 2009 20:12:58 +0200 (CEST) Received: from Tocksi.local (lns-bzn-48f-81-56-220-129.adsl.proxad.net [81.56.220.129]) by smtp1-g21.free.fr (Postfix) with ESMTP id 5444B9400DE; Thu, 25 Jun 2009 20:12:55 +0200 (CEST) Message-ID: <4A43BE22.1080802@univ-savoie.fr> Date: Thu, 25 Jun 2009 20:12:50 +0200 From: Christophe Raffalli User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Tiphaine Turpin Cc: Sylvain Le Gall , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Mastering the garbage collector References: <4A439067.8070104@irisa.fr> <4A4399A2.2090301@irisa.fr> In-Reply-To: <4A4399A2.2090301@irisa.fr> X-Enigmail-Version: 0.95.7 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9AE9B5EBCBC354B8C7C850B6" X-Spam: no; 0.00; christophe:01 raffalli:01 christophe:01 raffalli:01 univ-savoie:01 compaction:01 beginner's:01 ocaml:01 bug:01 val:01 cheers:01 chablais:01 73376:01 univ-savoie:01 garbage:01 X-Attachments: cset="utf-8" name="Christophe_Raffalli.vcf" name="Christophe_Raffalli.vcf" type="application/pgp-signature" name="signature.asc" name="signature.asc" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9AE9B5EBCBC354B8C7C850B6 Content-Type: multipart/mixed; boundary="------------000808030008050703050703" This is a multi-part message in MIME format. --------------000808030008050703050703 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Tiphaine Turpin a =E9crit : > Sylvain Le Gall a =E9crit : > =20 >> 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. >> =20 >> =20 > 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 > =20 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 per= form a complete new cycle. This=20 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 =3D ... in (* here you are not sure x is collected even if the variable does not appear after this comment *) let y =3D 3 in =2E.. Cheers, Christophe --=20 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=20 can check this signature. The public key is stored on www.keyserver.net --------------------------------------------- --------------000808030008050703050703 Content-Type: text/x-vcard; charset=utf-8; name="Christophe_Raffalli.vcf" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Christophe_Raffalli.vcf" begin:vcard fn:Christophe Raffalli n:Raffalli;Christophe org:LAMA (UMR 5127) email;internet:christophe.raffalli@univ-savoie.fr title;quoted-printable:Ma=3DC3=3DAEtre de conf=3DC3=3DA9rences 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 --------------000808030008050703050703-- --------------enig9AE9B5EBCBC354B8C7C850B6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFKQ74mi9jr/RgYAS4RAus/AJwN7NID1YzKSkqNfBTIgxyQ9iZjAgCg09HA vDFBt4+dA1h2UNFgMalASNU= =E7ph -----END PGP SIGNATURE----- --------------enig9AE9B5EBCBC354B8C7C850B6--