Version française
Home     About     Download     Resources     Contact us    
Browse thread
OCaml and Boehm
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: c-bauer-olsbruecken@t...
Subject: Re: [Caml-list] OCaml and Boehm
Basile STARYNKEVITCH <basile@starynkevitch.net> 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