Version française
Home     About     Download     Resources     Contact us    
Browse thread
Big array with data managed by another value
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Romain Beauxis <toots@r...>
Subject: Re: [Caml-list] Big array with data managed by another value
Le Friday 14 November 2008 16:10:13 Daniel Bünzli, vous avez écrit :
> I think I understood now, the original value was the custom block.
>
> If you were using the custom block only for finalization issues (not  
> serialization, hashing etc.) then one solution would be to replace  
> your custom block type by the bigarray itself. An register the  
> bigarray with Gc.finalise to deallocate the C pointer at the  
> appropriate time. Then you have
>
> type t = bigarray
> let to_bigarray x = x
>
> and no problems.

Yep, that's my current solution.
However, I see little interest to be able to allocate a big array with 
CAML_BA_EXTERNAL then.
The only situation where this would be of some interest is for using a caml 
callback from C, where you don't want the callback to finalize your data.
But you would never be able to convert a part of a custom data type to big 
array.

Thanks for your anwsers.

R.