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 113F87EE4B for ; Wed, 16 Oct 2013 16:03:20 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jacques-henri.jourdan@ens.fr) identity=pra; client-ip=176.31.242.187; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jacques-henri.jourdan@ens.fr"; x-sender="jacques-henri.jourdan@ens.fr"; x-conformance=sidf_compatible Received-SPF: Neutral (mail2-smtp-roc.national.inria.fr: domain of jacques-henri.jourdan@ens.fr does not assert whether or not 176.31.242.187 is permitted sender) identity=mailfrom; client-ip=176.31.242.187; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jacques-henri.jourdan@ens.fr"; x-sender="jacques-henri.jourdan@ens.fr"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@ulminfo.fr) identity=helo; client-ip=176.31.242.187; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jacques-henri.jourdan@ens.fr"; x-sender="postmaster@ulminfo.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvIBACycXlKwH/K7nGdsb2JhbABagmbAOoMAgR0WDgEBAQEBCBQJPIImAQWBCQshJQ8CRhMIAQEXh2wDvxmPWBaEDwOQKoEwmhKBQA X-IPAS-Result: AvIBACycXlKwH/K7nGdsb2JhbABagmbAOoMAgR0WDgEBAQEBCBQJPIImAQWBCQshJQ8CRhMIAQEXh2wDvxmPWBaEDwOQKoEwmhKBQA X-IronPort-AV: E=Sophos;i="4.93,507,1378850400"; d="asc'?scan'208";a="37302821" Received: from ulminfo.fr ([176.31.242.187]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 16 Oct 2013 16:03:18 +0200 Received: from [IPv6:2001:660:3013:3:224:e8ff:fec8:d018] (unknown [IPv6:2001:660:3013:3:224:e8ff:fec8:d018]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ulminfo.fr (Postfix) with ESMTPSA id 852F040D34 for ; Wed, 16 Oct 2013 16:03:18 +0200 (CEST) Message-ID: <525E9CA6.609@ens.fr> Date: Wed, 16 Oct 2013 16:03:18 +0200 From: Jacques-Henri Jourdan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: caml-list@inria.fr References: <20131014153023.GA19032@birba.invalid> In-Reply-To: <20131014153023.GA19032@birba.invalid> X-Enigmail-Version: 1.5.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="P4HPDxMMrAnh1lar8LLRrUbbVBM9aa3R2" Subject: Re: [Caml-list] Marshalling: automatic discard of unmashalable data via ephemerons This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --P4HPDxMMrAnh1lar8LLRrUbbVBM9aa3R2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, Le 14/10/2013 17:30, Enrico Tassi a =E9crit : > let collect k =3D HT.remove values !k >=20 > (* The only reference to the boxed key is the one returned, when the user= drops > it the value eventually disappears from the values table above *) > let create (v : 'a) : 'a key =3D > let k =3D mk_key () in > HT.add values !k (Obj.repr v); > Gc.finalise collect k; > k In that piece of code, you should take care to the fact that the finalizer can be called at /any/ moment. In particular, it can be called while you are modifying your hash table. If this situation happens, then you are modifying the hash table (by removing elements) when it is in an unconsistent state. Did you think about that ? Do I miss something ? The authors of Why3 encountered similar problems. I suggest you to read the Weakhtbl module, that gives a solution to this problem. Regards, --=20 Jacques-Henri Jourdan --P4HPDxMMrAnh1lar8LLRrUbbVBM9aa3R2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSXpymAAoJEGHoGlEY1GjFt6sH/1VpQsGQZhKgdSEvwrmMo1qw hMTOSjCsCpDdkqM2FNgDi6+SXvQk0vQgOR1fn2TnK5HJRa94HTZrpRyNQTudu3oO VUbdzVRGut16ha//M8BKABAarEvbHut1rmhdYZ0DtdGNDfFVGcHcu6gOP2O8VAlv eSs/IdzINrGJgpZev5TC94JGWDcSLZpjLWuxLl8LwiG+IFA0eOVG+49YjjI7sQIc 4r6VcdECsSiNGstR520cXhhztOGBy3TQ0YOcvKAgvVuWWJmSX+u1YMwzYOwh9/YL 3CyMDZYOL1pcz0172VcGRotI8IB6fFbY8bE9/+imBWQYi1YAZJs9lYq5dy50RnU= =Jvlz -----END PGP SIGNATURE----- --P4HPDxMMrAnh1lar8LLRrUbbVBM9aa3R2--