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_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 844D4BBAF for ; Wed, 23 Jul 2008 12:54:37 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAKmqhkjAXQIn/2dsb2JhbACyUg X-IronPort-AV: E=Sophos;i="4.31,238,1215381600"; d="scan'208";a="27601399" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 23 Jul 2008 12:54:37 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m6NAsaBN023924 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 23 Jul 2008 12:54:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlEAAEOrhkiYToBolGdsb2JhbACSTwEBAQEJAwoHEQWfSw X-IronPort-AV: E=Sophos;i="4.31,238,1215381600"; d="scan'208";a="13381633" Received: from mailgate3.iss.soton.ac.uk ([152.78.128.104]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Jul 2008 12:54:25 +0200 Received: from [152.78.96.56] (alpha.kk.soton.ac.uk [152.78.96.56]) (authenticated bits=0) by mailgate3.iss.soton.ac.uk (8.13.8/8.13.4) with ESMTP id m6NAsHYS019815 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 23 Jul 2008 11:54:19 +0100 Message-ID: <48870DD8.4050906@soton.ac.uk> Date: Wed, 23 Jul 2008 11:54:16 +0100 From: "Dr. Thomas Fischbacher" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060607 Debian/1.7.12-1.2 X-Accept-Language: en MIME-Version: 1.0 To: Caml-list List Subject: Memory statistics tool Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (mailgate3.iss.soton.ac.uk [152.78.128.104]); Wed, 23 Jul 2008 11:54:19 +0100 (BST) X-ISS-MailScanner-Information: Please contact Serviceline@soton.ac.uk for more information X-ISS-MailScanner: Found to be clean X-ISS-MailScanner-SpamCheck: X-Miltered: at concorde with ID 48870DEC.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 chunks:01 in-memory:01 marshal:01 int:01 data:02 data:02 argument:02 structures:02 string:02 traversal:03 optimization:03 module:03 float:03 root:04 Dear OCaml folks, when building large applications that work on complicated and highly networked data, one issue that easily comes up is to get some idea about what chunks of data eat all your memory. Now, it would be marvellous for data structure optimization purposes if there were a function memory_footprint: 'a -> int64 (or maybe float), which takes as argument a root (e.g. Obj.magic [|Obj.magic firstthingy; Obj.magic secondthingy; Obj.magic thirdthingy|]) and tells me how many cells are occupied by those ML data structures reachable from that root. Basically, this would correspond to using the GC's traversal mechanism and doing some internal statistics at the same time. My guess would be that the Marshal module "almost" has such a function already, to determine the amount of memory required to hold a string-serialized value. But as these values get compacted, the length of the string does not correspond to the number of words occupied by the in-memory data. Is there already something like that? Has anyone already built such a tool? -- best regards, Thomas Fischbacher t.fischbacher@soton.ac.uk