Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Alternative allocation of bigarrays
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-02-20 (19:38)
From: Christophe TROESTLER <Christophe.Troestler@u...>
Subject: Alternative allocation of bigarrays

I am interfacing OCaml with a C library that needs special allocation
functions for full speed (for alignment reasons).  I am wondering
about the best course to follow to create bigarrays with these new
malloc/free functions.

What I am doing now is to define a special "bigarray_create" based on
a spacial "alloc_bigarray" using tailored custom_operations.
Specifically, "alloc_bigarray" uses the new malloc and
"bigarray_finalize" of the "custom_operations" use the new free.  So
far I suppose there is no problem and they can share the OCaml
Bigarray types.  However I also changed the "custom_operations"'s
"identifier" and "bigarray_deserialize" so these bigarrays are
deserialized with the new malloc.  Can I still use the standard
bigarray types with these new arrays ?  (I would guess so but I'd like
a confirmation here.)

Also, if better approaches are possible, I will be happy to know them.
(The current solution requires to duplicate a lot of bigarray.c code.)