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=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 22720BBAF for ; Wed, 6 May 2009 20:01:56 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkoBALRtAUqYToBpkWdsb2JhbACWeAEBAQEJCwoHEQW6QIQBBQ X-IronPort-AV: E=Sophos;i="4.40,303,1238968800"; d="scan'208";a="25731161" Received: from mailgate4.iss.soton.ac.uk ([152.78.128.105]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 May 2009 20:01:55 +0200 Received: from mailgate4.iss.soton.ac.uk (localhost.localdomain [127.0.0.1]) by mailgate4.iss.soton.ac.uk (8.13.8/8.13.4) with ESMTP id n46I1aSR006292; Wed, 6 May 2009 19:01:36 +0100 Received: from UOS-MSG00012-SI.soton.ac.uk (uos-msg00012-si.soton.ac.uk [152.78.119.35]) by mailgate4.iss.soton.ac.uk (mailgate4.iss.soton.ac.uk [152.78.128.105]) envelope-from with ESMTP id l45J1a0907315788CK ret-id none; Wed, 06 May 2009 19:01:36 +0100 Received: from alpha.sesnet.soton.ac.uk (152.78.96.56) by smtp.soton.ac.uk (152.78.119.35) with Microsoft SMTP Server id 8.1.291.1; Wed, 6 May 2009 18:53:57 +0100 Received: from [127.0.0.1] (localhost [127.0.0.1]) by alpha.sesnet.soton.ac.uk (Postfix) with ESMTP id 385B2163537; Wed, 6 May 2009 18:53:57 +0100 (BST) Message-ID: <4A01CEB4.10907@soton.ac.uk> Date: Wed, 6 May 2009 18:53:56 +0100 From: "Dr. Thomas Fischbacher" User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Markus Mottl Cc: OCaml List Subject: Re: [Caml-list] Custom blocks and finalization References: <49FB04A9.3090008@soton.ac.uk> <4A01BB13.1040602@soton.ac.uk> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: Pass (UOS-MSG00012-SI.soton.ac.uk: domain of t.fischbacher@soton.ac.uk designates 152.78.96.56 as permitted sender) receiver=UOS-MSG00012-SI.soton.ac.uk; client-ip=152.78.96.56; helo=alpha.sesnet.soton.ac.uk; X-smtpf-Report: client=relay,white,ipv6; mail=; rcpt= X-ISS-MailScanner-Information: Please contact Serviceline@soton.ac.uk for more information X-ISS-MailScanner: Found to be clean X-Spam: no; 0.00; markus:01 evidently:01 finalizer:01 serializer:01 manipulates:01 runtime:01 runtime:01 ocaml:01 finalizer:01 hash:01 serialize:01 deserialize:01 descriptors:01 camlparam:01 camlreturn:01 Markus, > Neither of the above will ever trigger a garbage collection, but they > are still prohibited. So, I ask: Why? Unregistering a global root evidently does not trigger a GC, and starting a GC from within a C-registered custom hasher/finalizer/comparer/serializer/etc is the one specific thing that according to the docs causes trouble, so I don't really see why I should go through quite a fair bit of our codebase to come up with a fix to something which as far as I can see must not be a problem. > It certainly doesn't, but it obviously manipulates runtime > datastructures which may not necessarily be in a state during > finalization where this is safe. I'd have to study the runtime code > in detail to learn more, but maybe the OCaml team can clarify this > issue more quickly? > Yes, clarification would be much appreciated. I still maintain that my use of caml_remove_global_root() in a finalizer is not in violation of this spec: ===> Note: the finalize, compare, hash, serialize and deserialize functions attached to custom block descriptors must never trigger a garbage collection. Within these functions, do not call any of the Caml allocation functions, and do not perform a callback into Caml code. Do not use CAMLparam to register the parameters to these functions, and do not use CAMLreturn to return the result. <=== So, if there is a problem with this practice, it is certainly an OCaml bug (i.e. spec not matching behaviour) and should be fixed by the OCaml team. -- best regards, Thomas Fischbacher t.fischbacher@soton.ac.uk