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: Li-Thiao-Té_Sébastien <sayan@c...>
Subject: Re: [Caml-list] Documentation request: allocation of bigarrays in C
Dmitry Bely wrote:
> sayan@crans.org writes:
> 
>>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?
> 
Why is there a C bigarray allocation function at all then ? :)

In my case, I want to read a relatively big file (50MB) containing 
arrays of floats . I use C functions for the raw speed then pass the 
bigarrays to OCaml to do some reordering of the data, and higher-level 
processing.

I do not open the file in Ocaml then send a string to C for parsing, but 
rather open the file in C and return the bigarray list to Ocaml. (cf my 
previous mistake on creating Ocaml lists in C on this mailing-list)

I have hundreds of such files that I may want to load and compare 
interactively, so reclaiming unused memory is a big bonus.

-- 
Li-Thiao-Té Sébastien