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=0.0 required=5.0 tests=none 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 9FFC5BBAF for ; Sat, 11 Apr 2009 12:35:51 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AloBALQP4EnUnwdkjWdsb2JhbACCIJQVAQEBAQkJCgkPBrJyg3wG X-IronPort-AV: E=Sophos;i="4.40,171,1238968800"; d="scan'208";a="26074196" Received: from relay.pcl-ipout02.plus.net ([212.159.7.100]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 11 Apr 2009 12:35:51 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArEFALQP4EnUnw6U/2dsb2JhbACCIMdFg3wG Received: from fhw-relay07.plus.net ([212.159.14.148]) by relay.pcl-ipout02.plus.net with ESMTP; 11 Apr 2009 11:35:50 +0100 Received: from [87.113.30.188] (helo=leper.local) by fhw-relay07.plus.net with esmtp (Exim) id 1LsaYu-0006TG-PL for caml-list@yquem.inria.fr; Sat, 11 Apr 2009 11:35:48 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] OCaml and Boehm Date: Sat, 11 Apr 2009 11:42:23 +0100 User-Agent: KMail/1.9.9 References: <4a708d20904101313s49ef3b75m45202b6bda800b77@mail.gmail.com> <49E066E5.8060107@starynkevitch.net> In-Reply-To: <49E066E5.8060107@starynkevitch.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904111142.23884.jon@ffconsultancy.com> X-Plusnet-Relay: 0fe60862c2b14255c261082f8fcda763 X-Spam: no; 0.00; ocaml:01 boehm:01 basile:01 lukasz:01 ocaml:01 runtime:01 boehm:01 traversing:01 ocaml's:01 patched:01 pointers:01 admittedly:01 pointer:01 pointers:01 arrays:01 On Saturday 11 April 2009 10:46:13 Basile STARYNKEVITCH wrote: > Lukasz Stafiniak wrote: > > Hi, > > > > Is the OCaml runtime Boehm-safe? That is, can it be run with Boehm > > turned on and traversing OCaml's heap? (So that the OCaml heap can > > provide roots to Boehm.) And if not, could it be patched to make it > > Boehm-safe in this sense? > > Probably not. Because I am not sure of what you mean by Boehm-safe, > since Boehm's GC is conservative and do not make much promises. Boehm's GC breaks on various code, most notably code that "hides" pointers to reachable data in an indirect form. The most famous example that breaks Boehm is the (admittedly awful and technically illegal) pointer bump trick used in Numerical Recipies to bring the wonderous starting-at-one indexes of Fortran to the C world. Boehm fails to recognise the bumped pointers as references into reachable data and goes right ahead and deallocates all of your numerical arrays for you. > There is a reason for all this. The major strength of Ocaml runtime is > its robustness and its efficiency. The efficiency of Ocaml GC is of > paramount importance (it supports very high allocation rate, which is > out of reach for the Boehm collector; and big allocation rate is typical > of most functional programs; the typical allocation speed within the > Ocaml runtime is at least one or two order of magnitudes faster than > that of GC_malloc; a typical GC_malloc is by itself a bit slower than a > libc malloc.). Regarding OCaml vs libc malloc, I had always assumed that but HLVM appears to have proven otherwise. It uses malloc and free directly with no optimization whatsoever yet it is now well within 2x the performance of OCaml on the allocation and GC intensive 10-queens benchmark. Boehm's allocator is asymptotically slower than malloc, of course. -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e