From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p5DCY3eJ020930 for ; Mon, 13 Jun 2011 14:34:03 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjsDALgC9k3DumTpgWdsb2JhbABSpkoBARYmJYhyv0IOhhYElgOLEA X-IronPort-AV: E=Sophos;i="4.65,358,1304287200"; d="scan'208";a="96667377" Received: from nwas17.bluewin.ch (HELO zhbdzmsp-nwas17.bluewin.ch) ([195.186.100.233]) by mail2-smtp-roc.national.inria.fr with ESMTP; 13 Jun 2011 14:33:57 +0200 Received: from [83.76.55.36] ([83.76.55.36:50148] helo=seldon) by zhbdzmsp-nwas17.bluewin.ch (envelope-from ) (ecelerity 2.2.2.45 r()) with ESMTP id CD/EA-18474-EE306FD4; Mon, 13 Jun 2011 12:34:55 +0000 Received: from yziquel by seldon with local (Exim 4.72) (envelope-from ) id 1QW67E-0003e6-8c; Mon, 13 Jun 2011 14:19:36 +0200 Date: Mon, 13 Jun 2011 14:19:36 +0200 From: Guillaume Yziquel To: ygrek Cc: caml-list@inria.fr Message-ID: <20110613121936.GA637@localhost> References: <4DF55B5D.9090302@ropas.snu.ac.kr> <20110613143407.0fe166ce.ygrekheretix@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20110613143407.0fe166ce.ygrekheretix@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] A question about GC. Le Monday 13 Jun 2011 à 14:34:07 (+0300), ygrek a écrit : > On Mon, 13 Jun 2011 12:37:46 +0200 > Philippe Wang wrote: > > > As far as I know, when OCaml's GC is not working as expected, it's > > (almost) always because there are blocks allocated outside OCaml's > > heap (a.k.a. custom blocks). > > Custom blocks are allocated on ocaml heap. No, not always. Nothing stops you from putting custom blocks outside of the ocaml heap. It might even sometimes make sense. Though usually you're fine allocating custom blocks on the ocaml heap with a pointer to out of heap data. > > How big are custom blocks? The bigger they are, the worst the behavior > > tends to be. > > Why? Because the GC relies on the two last arguments of caml_alloc_custom to properly evaluate the memory impact of allocating a custom block together with the data it refers to. It's easy to get it wrong for large data, and thus miscalibrate the GC on these blocks. However, the fact that grey values seem to accumulate doesn't seem to fit with such an simple explanation. But maybe Philippe is thinking about something else when talking about "big custom blocks allocated outside of the ocaml heap". -- Guillaume Yziquel