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=0.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 28E18BC37 for ; Wed, 27 May 2009 03:46:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAPo3HEqFBoIF/2dsb2JhbADOPgEEhAs X-IronPort-AV: E=Sophos;i="4.41,255,1241388000"; d="scan'208";a="30007225" Received: from rabbit.math.nagoya-u.ac.jp (HELO mailhost.math.nagoya-u.ac.jp) ([133.6.130.5]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 May 2009 03:46:30 +0200 Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id A077CB697; Wed, 27 May 2009 10:46:27 +0900 (JST) Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id 1761188A3; Wed, 27 May 2009 10:46:27 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=math.nagoya-u.ac.jp; h= date:message-id:to:cc:subject:from:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=alpha; bh=LgrIiTua5vG3Q1drearFkxxQB2A=; b=z6IJsbcqSZvP/yU7kxv6fAJiJ5QU ObXr3+abeKAj42zhWHKFt6IQCc19pe1sxqvhaGo13Vnr1WXawXYyk8uHe46Z6iaj rriz2Bo/MhjBD9/0mpVUdUmx0x6645PjwoFsk31F1rQhiDu5EAvdX/Wkzj2G++X+ pAMrM2C3xEo5X4Y= DomainKey-Signature: a=rsa-sha1; h=Received:Date:Message-Id:To:Cc:Subject:From:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; b=trkVB03keqQGSBjksrFqTC0hJ32kvinhldsathtM9B6jU1iC+o4xUMTMYUiuGxvrjDqEImRTM+HK+++0bAK6JhPrjFw+f2sR4jXaq09Ywsf+1Y6J52kiNy2PRd4CS9MZ1mStgMCMh6cTHnvz1ENqXiQdWjJm7tOCfNFpX5JYKt8=; c=nofws; d=math.nagoya-u.ac.jp; q=dns; s=alpha Received: from localhost (millas [172.16.30.29]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id 8A32A88A1; Wed, 27 May 2009 10:46:26 +0900 (JST) Date: Wed, 27 May 2009 10:46:24 +0900 (JST) Message-Id: <20090527.104624.238257994.garrigue@math.nagoya-u.ac.jp> To: guillaume.hennequin@epfl.ch Cc: martin.jambon@ens-lyon.org, caml-list@inria.fr Subject: Re: [Caml-list] let x = ... in object ... From: Jacques Garrigue In-Reply-To: References: <4A1BE36C.70200@ens-lyon.org> X-Mailer: Mew version 6.2 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; guillaume:01 guillaume:01 toplevel:01 val:01 val:01 mya:98 caml-list:01 epfl:02 garrigue:03 garrigue:03 jacques:03 jacques:03 let:03 let:03 nagoya-u:04 From: Guillaume Hennequin > well, I have just tested this in the toplevel > > class a n = > let x = Array.make_matrix n n 0. in > object(self) > val y = Array.init n (fun i -> Array.copy x.(i)) > method y = y > end ;; > > let mya = new a 10000 ;; > > ---------> memory consumption 78.5 (from top) > > Gc.full_major () ;; > > ---------> memory consumption is still 78.9 Try with class a n = let x = Array.make_matrix n n 0. in object(self) val y = Array.init n (fun i -> Array.fold_left (+) 0. x.(i)) method y = y end ;; After the gc, x is collected. What you are seeing is the size taken by y. Jacques Garrigue