Version française
Home     About     Download     Resources     Contact us    
Browse thread
Documentation request: allocation of bigarrays in C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dbely@m...>
Subject: Re: [Caml-list] Documentation request: allocation of bigarrays in C
sayan@crans.org writes:

> Please add the following fact to the Bigarray module documentation (I
> had to look at the c source header) and/or correct it as necessary :
>
> A pointer allocated from C using malloc is not freed by the OCaml
> garbage collector.

Of course - it's not possible in general.

> If you want to be GC-friendly, use the bigarray
> allocation macros with a NULL pointer to allocate memory then get a
> pointer to the data array.

If you need GC-controlled bigarray, why simply not to use
Bigarray.Genarray.create?

- Dmitry Bely