From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 8C89080023 for ; Mon, 10 Oct 2016 15:14:41 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.31,324,1473112800"; d="scan'208";a="196248678" Received: from argosim.pro.38.cust.bluenetech.net (HELO [192.168.1.108]) ([109.197.105.43]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 10 Oct 2016 15:14:41 +0200 To: caml-list@inria.fr From: Bertrand Jeannet Message-ID: <57FB9441.3060703@inria.fr> Date: Mon, 10 Oct 2016 15:14:41 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] Ephemerons: is this behavior correct ? Dear list, The following piece of code raises an assert false exception (in rare cases) with official version 4.03.0: match Ephemeron.K1.get_data c with | Some _ -> match Ephemeron.K1.get_key c with | Some _ -> (* ... *) | None -> assert false (* reachable *) Before I had called the function K1.set_key_data with a key * that belongs to a weak hashed set * and that is used after the call (this may be important or not). The documentation of the Ephemeron module says: "When one of the keys is not considered alive anymore by the GC, the data is emptied from the ephemeron" I was expecting this to happen atomically from the programmer point of view, but here apparently the key was emptied but the data kept (at least temporarily). Was this behavior anticipated ? IMHO, synchronized deletion is simpler and safer (in previous versions, I encountered the now-solved-bug that the deletion of several weak pointers to the same object was not synchronized). Btw, the Ephemeron module does not appear on this url: http://caml.inria.fr/pub/docs/manual-ocaml/stdlib.html one has to go to http://caml.inria.fr/pub/docs/manual-ocaml/libref/index.html Best regards