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=UNPARSEABLE_RELAY autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 34205BBC4 for ; Mon, 13 Apr 2009 11:44:40 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4CAD+m4knCGYZVk2dsb2JhbACWMwEBAQEJCQoJEQNAsXYHg3UG X-IronPort-AV: E=Sophos;i="4.40,179,1238968800"; d="scan'208";a="38386206" Received: from mailout11.t-online.de ([194.25.134.85]) by mail4-smtp-sop.national.inria.fr with ESMTP; 13 Apr 2009 11:44:39 +0200 Received: from fwd09.aul.t-online.de by mailout11.sul.t-online.de with smtp id 1LtIiT-0005wW-00; Mon, 13 Apr 2009 11:44:37 +0200 Received: from elefant (VmASFgZHrhHjPl+fajYKKBJ2WeVzD+k7ojFaJIPcTanpJO1tHoYPNklg7WXOZ5ugEx@[217.86.106.165]) by fwd09.aul.t-online.de with esmtp id 1LtIiM-21sp8a0; Mon, 13 Apr 2009 11:44:30 +0200 Received: from fridolin by elefant with local (Exim 4.69) (envelope-from ) id 1LtIg2-0000kq-3V; Mon, 13 Apr 2009 11:42:06 +0200 To: Basile STARYNKEVITCH Cc: Lukasz Stafiniak , Caml Subject: Re: [Caml-list] OCaml and Boehm References: <4a708d20904101313s49ef3b75m45202b6bda800b77@mail.gmail.com> <49E066E5.8060107@starynkevitch.net> <4a708d20904110511o7d390807r3d29400cf96d6f35@mail.gmail.com> <49E09C2D.4080906@starynkevitch.net> <4a708d20904110711i199ef805h611a04d823c8fb51@mail.gmail.com> <49E0B15C.6080208@starynkevitch.net> From: c-bauer-olsbruecken@t-online.de (Christoph Bauer) Date: Mon, 13 Apr 2009 11:42:05 +0200 In-Reply-To: <49E0B15C.6080208@starynkevitch.net> (Basile STARYNKEVITCH's message of "Sat\, 11 Apr 2009 17\:03\:56 +0200") Message-ID: <87bpr0khzm.fsf@christoph-bauer.net> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-ID: VmASFgZHrhHjPl+fajYKKBJ2WeVzD+k7ojFaJIPcTanpJO1tHoYPNklg7WXOZ5ugEx X-TOI-MSGID: 15566d68-e915-4232-b61c-2264c699326f X-Spam: no; 0.00; ocaml:01 boehm:01 basile:01 basile:01 lukasz:01 boehm:01 pointers:01 objs:01 objs:01 ocaml:01 val:01 alloc:01 alloc:01 sizeof:01 val:01 Basile STARYNKEVITCH writes: > Lukasz Stafiniak wrote: >>> >> It is a large application. They debate whether to use Boehm or smart >> pointers. They already have embedded Scheme (Guile) and are about to >> embed Python. (Guile is said to be Boehm-compatible, in some sense, >> from the next version.) It is possible that Boehm is a no-way for >> them, I asked here to investigate this. >> > > My advice is always to avoid mixing several garbage collection > techniques or implementations inside the same program. > TCL uses refcounted Tcl_Objs. We use these Tcl_Objs in OCaml for a long time. And it works excellent. Here are the two most important wrapper functions: static void finalize_tclobj( value v ) { Tcl_DecrRefCount( TclObj_val (v) ); } static value alloc_tcl_obj( Tcl_Obj * obj ) { value v = caml_alloc_custom( &tcl_obj_ops, sizeof( Tcl_Obj * ), 0, 1 ); Tcl_IncrRefCount( obj ); TclObj_val( v ) = obj; return v; } So I guess, it's easier to use smart pointers. Christoph Bauer