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=AWL 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 030A3BBAF for ; Wed, 23 Jul 2008 15:16:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAO/LhkjAXQIm/2dsb2JhbACyVA X-IronPort-AV: E=Sophos;i="4.31,238,1215381600"; d="scan'208";a="15388120" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 23 Jul 2008 15:16:43 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m6NDGh51014930 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 23 Jul 2008 15:16:43 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq0DACvMhkhQDPIaXWdsb2JhbACSRBUFBAQIEAWfUA X-IronPort-AV: E=Sophos;i="4.31,238,1215381600"; d="scan'208";a="13386214" Received: from smtp20.orange.fr ([80.12.242.26]) by mail2-smtp-roc.national.inria.fr with ESMTP; 23 Jul 2008 15:16:43 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2003.orange.fr (SMTP Server) with ESMTP id ADCE01C000BC; Wed, 23 Jul 2008 15:16:42 +0200 (CEST) Received: from [192.168.1.66] (APuteaux-154-1-59-95.w81-249.abo.wanadoo.fr [81.249.66.95]) by mwinf2003.orange.fr (SMTP Server) with ESMTP id 6ECC81C000B5; Wed, 23 Jul 2008 15:16:42 +0200 (CEST) X-ME-UUID: 20080723131642453.6ECC81C000B5@mwinf2003.orange.fr Message-ID: <48872F38.30609@frisch.fr> Date: Wed, 23 Jul 2008 15:16:40 +0200 From: Alain Frisch User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: "Dr. Thomas Fischbacher" Cc: dmitry grebeniuk , "caml-list@inria.fr" Subject: Re: [Caml-list] Memory statistics tool References: <48870DD8.4050906@soton.ac.uk> <1497034692.20080723154431@moldavcable.com> <48872D6E.20209@soton.ac.uk> In-Reply-To: <48872D6E.20209@soton.ac.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 48872F3B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; frisch:01 frisch:01 compaction:01 ocaml:01 ocaml:01 hash:01 hash:01 hashtbl:01 struct:01 hashtbl:01 equality:01 polymorphic:01 polymorphic:01 heap:01 caml-list:01 > Many thanks! I just had a glance at it, but it seems to be just how one > would have to approach such a problem. (The issue with hash-based > approaches to find previously visited substructures is that during > traversal, a GC may occur. Now I just assume that this may involve > relocation and heap compaction in OCaml. The problem then is that > OCaml does not properly support what would be known as eq hash tables > in Lisp.) As long as the data structure supports the polymorphic hash function, it should work to simply use a regular hash table with the polymorphic hash function and physical equality, as in: module S = Hashtbl.Make(struct type t = Obj.t let hash = Hashtbl.hash let equal = (==) end);; (Of course, this might be quite slow.) -- Alain