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.0 required=5.0 tests=none autolearn=disabled version=3.1.3 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 3E8CCBC69 for ; Fri, 7 Dec 2007 12:32:01 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAHe+WEfAXQImh2dsb2JhbACPVwIBCAop X-IronPort-AV: E=Sophos;i="4.23,266,1194217200"; d="scan'208";a="5378868" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 07 Dec 2007 12:32:01 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id lB7BW0ZT024323 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 7 Dec 2007 12:32:00 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAIe9WEfBL1AZh2dsb2JhbACPVwIBCAop X-IronPort-AV: E=Sophos;i="4.23,266,1194217200"; d="scan'208";a="6580774" Received: from gw.exalead.com (HELO exalead.com) ([193.47.80.25]) by mail3-smtp-sop.national.inria.fr with ESMTP; 07 Dec 2007 12:32:00 +0100 Received: from [192.168.204.148] (madpc064.exalead.com [192.168.204.148]) (authenticated bits=0) by exalead.com (8.14.0/8.14.0) with ESMTP id lB7BVxHL002756 for ; Fri, 7 Dec 2007 12:31:59 +0100 Message-ID: <47592F2F.5080900@exalead.com> Date: Fri, 07 Dec 2007 12:31:59 +0100 From: Berke Durak User-Agent: Thunderbird 1.5.0.10 (X11/20070221) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Questions on replacing finalizers and memory footprints References: <4757D904.2090502@functionality.de> <475909E8.7010301@inria.fr> In-Reply-To: <475909E8.7010301@inria.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at discorde with ID 47592F30.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; berke:01 durak:01 berke:01 durak:01 finalizers:01 footprints:01 arrays:01 runtime:01 lri:01 filliatr:01 beginner's:01 ocaml:01 bug:01 hashtable:01 typer:01 Xavier Leroy a écrit : >> Also, is there a simple way to implement a function (perhaps using >> Obj.magic) which will walk a (possibly circular) network of tuples, >> arrays, variadic entities and lists, and return the total number of >> bytes used up by that structure? I see that this should be possible >> in principle with the present implementation of the runtime if one >> could get some basic information about the internal type of an >> array. > > Jean-Christophe Filliātre's "size" library does exactly this: > > http://www.lri.fr/~filliatr/software.en.html > > - Xavier Leroy > > _______________________________________________ > 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 Hello, I once had more or less the same problem in the EDOS project with huge data structures. Filliātre's size library was also growing too large a hashtable, so I decided to use something else. My solution was to marshal the data structure and then analyze the marshalled data by recomputing its type. You first write a TYPER module that represents the types in your marshalled data structure, then use the Analyzer module on your output. I was more interested in the size strings were taking in memory, but it should be easy to modify. All the ugly parts (parsing the marshal format, and the combinators for describing the types) have been defined. https://protactinium.pps.jussieu.fr:12345/svn/edos/users/berke/dvhfz/analyze.ml -- Berke DURAK