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.9 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 01BF9BBAF for ; Wed, 6 May 2009 18:54:36 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjoCAIddAUrRVdypkGdsb2JhbACDAJM5PwEBAQEJCQwHEQOoN4EKkFABAwEDg34FiAo X-IronPort-AV: E=Sophos;i="4.40,303,1238968800"; d="scan'208";a="27316431" Received: from mail-fx0-f169.google.com ([209.85.220.169]) by mail3-smtp-sop.national.inria.fr with ESMTP; 06 May 2009 18:54:36 +0200 Received: by fxm17 with SMTP id 17so341849fxm.27 for ; Wed, 06 May 2009 09:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hso3QVJN8/BW7k9bhQU/2oz+j8C4lDYJ3nCzUqlHa+o=; b=C7pLrDnXz68XoKNjyXzY3Ywv/9Gzch+w0zU4UlXtiWjk+c00JuoPUsVLFk8SLgHI+H NCpHh8oGGOU+1odPVfCGvBDed8lhaWHYvw8g2YtYyrt9NKEblwPWnsaj5zsjJDwqMp7U pn6FsMEvBax7D7eNGIgqauZgAn2vuv5xn7CLc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=IyH7aSqufpDB9GdBLTHmFdwBZ1iMotRlhLV5W8CB2rN+SxkMipD6ybBSOGzqtSmp2h Yzlgqp7h0l9Q/wBLPVwCpic6Vtj1DEtAjYarCgfOdHKW3a48AwGpKIBwm1Kvc5O+VZCb 8Am6VOgQRgcWOrhOAGN6tLFGmTXN7p3YwVzV0= MIME-Version: 1.0 Received: by 10.86.31.18 with SMTP id e18mr1490107fge.72.1241628875897; Wed, 06 May 2009 09:54:35 -0700 (PDT) In-Reply-To: <4A01BB13.1040602@soton.ac.uk> References: <49FB04A9.3090008@soton.ac.uk> <4A01BB13.1040602@soton.ac.uk> Date: Wed, 6 May 2009 12:54:35 -0400 Message-ID: Subject: Re: [Caml-list] Custom blocks and finalization From: Markus Mottl To: "Dr. Thomas Fischbacher" Cc: OCaml List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 camlparam:01 camlreturn:01 runtime:01 finalizer:01 byterun:01 globroots:01 manipulates:01 runtime:01 ocaml:01 ocaml:01 2009:98 On Wed, May 6, 2009 at 12:30, Dr. Thomas Fischbacher > I take it you are referring to this part of the documentation (18.9.1 > bottom): > > ===> [snip] Yes. > Do not use CAMLparam to register > the > parameters to these functions, and do not use CAMLreturn to return the > result. Neither of the above will ever trigger a garbage collection, but they are still prohibited. I don't know why these restrictions are required, but according to the documentation it seems dangerous to manipulate any runtime datastructures while in a finalizer. > Let's have a look at byterun/globroots.c: [snip] > So... how could caml_remove_global_root() actually trigger a heap GC? 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? Regards, Markus -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com