From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 7E0BC7FA5C for ; Tue, 21 Jun 2016 21:37:25 +0200 (CEST) IronPort-PHdr: 9a23:7Z0EQhwkbQtWMevXCy+O+j09IxM/srCxBDY+r6Qd0OoUIJqq85mqBkHD//Il1AaPBtSDraocwLqI+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuS9aU15z8h7760qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jFrxDFwgyO/Uw2VW8RjlIcDRLM6hr9X4y3uCzwsfZV0ySTe8PsG/R8Uj2n6+JvSQT0oCYBLT8wtm/N2eJqi6cOiRaopho37ZTVe4qVfK53eqrce5UUX2taVcZ5UyFRA429KYAICrxSbq5js4Dhqg5W/lOFDg62Cbaqk2cQiw== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=alain.frisch@lexifi.com; spf=None smtp.mailfrom=alain.frisch@lexifi.com; spf=None smtp.helo=postmaster@mx20.yaziba.net Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain.frisch@lexifi.com) identity=pra; client-ip=85.233.204.164; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain.frisch@lexifi.com"; x-sender="alain.frisch@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain.frisch@lexifi.com) identity=mailfrom; client-ip=85.233.204.164; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain.frisch@lexifi.com"; x-sender="alain.frisch@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mx20.yaziba.net) identity=helo; client-ip=85.233.204.164; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain.frisch@lexifi.com"; x-sender="postmaster@mx20.yaziba.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BMAgCqlmlXh6TM6VVdhD+9Q4YXAoE1PBABAQEBAQEBAREBAQEKCwkJIS+CMYIbAQEEODQdCxguVwYBDAgBAYgwwn8BCgEBAQEihieBdwiCToRAhVsBBJh5gViMVIlGhV2PdgI1giYSCxeBN4s0AQEB X-IPAS-Result: A0BMAgCqlmlXh6TM6VVdhD+9Q4YXAoE1PBABAQEBAQEBAREBAQEKCwkJIS+CMYIbAQEEODQdCxguVwYBDAgBAYgwwn8BCgEBAQEihieBdwiCToRAhVsBBJh5gViMVIlGhV2PdgI1giYSCxeBN4s0AQEB X-IronPort-AV: E=Sophos;i="5.26,505,1459807200"; d="scan'208";a="223352612" Received: from mx20.yaziba.net ([85.233.204.164]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Jun 2016 21:37:24 +0200 Received: from mta20.int.yaziba.net (mta20.int.yaziba.net [10.4.20.31]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx20.yaziba.net (mx10.yaziba.net) with ESMTPS id 66DA21A7854; Tue, 21 Jun 2016 21:37:24 +0200 (CEST) Received: from mta20.int.yaziba.net (localhost [127.0.0.1]) by mta20.int.yaziba.net (Postfix) with ESMTPS id 7339DCA657; Tue, 21 Jun 2016 21:37:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta20.int.yaziba.net (Postfix) with ESMTP id 61D0ACA763; Tue, 21 Jun 2016 21:37:24 +0200 (CEST) X-Virus-Scanned: amavisd-new at mta20.int.yaziba.net Received: from mta20.int.yaziba.net ([127.0.0.1]) by localhost (mta20.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zrDt0rdPbTvf; Tue, 21 Jun 2016 21:37:24 +0200 (CEST) Received: from [192.168.1.11] (LFbn-1-535-219.w86-245.abo.wanadoo.fr [86.245.27.219]) by mta20.int.yaziba.net (Postfix) with ESMTPSA id 1DFDBCA657; Tue, 21 Jun 2016 21:37:24 +0200 (CEST) To: =?UTF-8?Q?Fran=c3=a7ois_Bobot?= , caml-list@inria.fr References: <7182303B-EBFF-4CFC-A7DF-B5C7A059509F@marneu.com> <3673db34-9350-a9b1-fcd5-e7593ba0fd01@etorok.net> <86eg7ucu8s.fsf@lpw25.net> <0d64f186-6518-dea7-9082-4c06802449f7@cea.fr> From: Alain Frisch Message-ID: <8718df5d-2129-2404-ab56-188331d15a6d@lexifi.com> Date: Tue, 21 Jun 2016 21:37:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <0d64f186-6518-dea7-9082-4c06802449f7@cea.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrfeeltddrtddtgddutdeiucetufdoteggodetrfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdgjtegkkfeuteenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffgggjggtgfesthhqredttdefheenucfhrhhomheptehlrghinhcuhfhrihhstghhuceorghlrghinhdrfhhrihhstghhsehlvgigihhfihdrtghomheqnecukfhppeekiedrvdeghedrvdejrddvudelnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhht X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Subject: Re: [Caml-list] Presumed bug in OCaml's garbage collector or in its Weak module... On 21/06/2016 14:43, Fran=E7ois Bobot wrote: > However it would be interesting to keep the nice property that > `get_copy` give us for the implementation of weak structure, without > using unsafe features. The nice property is that a value is not kept > alive just because it collides with a value that is often accessed. > Perhaps a kind of transient roots, which are considered as root only at > the end of the each part of mark phase, would allow to mark the value as > few time as possible. But the API would not be pretty... Not directly related to this thread, but it might be worth mentioning=20 that for our use case (hash-consing terms), disabling the shallow copy=20 (i.e. using get instead of get_copy) lead to very significant=20 performance gains. The main explanation is probably that it reduces=20 quite a bit the pressure on the GC (more than the avoided cost of the=20 copy itself, I guess). Another possible explanation is that keeping=20 some values a bit longer in the weak set is actually a good thing in our=20 usage scenario (we keep some derived values, computed only when the term=20 is first inserted in the weak set); this is also exacerbated by the=20 lower rate of the GC (the first explanation). We are "saved" by the=20 fact that phases that exercises the weak set a lot are alternating with=20 other GC-intensive phases (which guarantee that the weak set are=20 eventually pruned). Perhaps the "official" Weak.Make should at least allow to use get=20 instead of get_copy? Alain