From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4214FBB84 for ; Mon, 15 May 2006 21:38:01 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k4FJc0Hb030704 for ; Mon, 15 May 2006 21:38:00 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA12381 for ; Mon, 15 May 2006 21:38:00 +0200 (MET DST) Received: from smtp.cegetel.net (mf00.sitadelle.com [212.94.174.67]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k4FJbxBF011427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 15 May 2006 21:38:00 +0200 Received: from [192.168.144.2] (84-4-96-136.adslgp.cegetel.net [84.4.96.136]) by smtp.cegetel.net (Postfix) with ESMTP id 162ED1A47F4; Mon, 15 May 2006 21:37:58 +0200 (CEST) Message-ID: <4468D898.4050909@univ-savoie.fr> Date: Mon, 15 May 2006 21:38:00 +0200 From: Christophe Raffalli User-Agent: Thunderbird 1.5.0.2 (X11/20060501) MIME-Version: 1.0 To: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Cc: caml-list Subject: Re: [Caml-list] GC and map References: <446874CE.6010405@univ-savoie.fr> <5E0CCADE-4A12-47B7-A11A-B0CD949FE0F6@epfl.ch> In-Reply-To: <5E0CCADE-4A12-47B7-A11A-B0CD949FE0F6@epfl.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at nez-perce with ID 4468D898.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4468D897.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 raffalli:01 christophe:01 raffalli:01 univ-savoie:01 bunzli:01 hash:01 hash:01 ocaml:01 ocaml:01 libref:01 wrote:01 caml-list:01 closures:01 closures:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 Daniel Bünzli wrote: > Can't you just use weak hash tables [1] in some way to implement that ? > In fact, to make it simpler, I want weak key functional map. That is functional map where binding are GC-collected when the key is no more accessible by the GC. I did not present it this way, because this requires equal key to be physically equal which does not fit with functional map, but this is not a real problem in my case. If I remember well previous investigations, it is tricky and ugly but possible to implement weak key imperative hash table from the poor weak array of OCaml. But weak key functional map seems impossible (I have no proof ;-). The use for that is to try it for an evaluator for a toy functional language where the key are variable names and the maps hold the value of the variables. I do not want to simplify maps by hand where some variables do not exists in specific closure and I had like the GC to do it. Actually, this approach is not the one use in OCaml: when closures are build by OCaml, specific environments are build with only the required variables to make sure there is no memory leak. In my approach, you can share environments between many closures, but the scan of the environment by the GC is much more complex (not sure this is really a gain anyway) > Best, > > Daniel > > [1]