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: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] Big array with data managed by another value

Le 14 nov. 08 à 15:03, Romain Beauxis a écrit :

> We can pass the CAML_BA_EXTERNAL flag to the bigarray, so that the  
> Gc doesn't
> touch data pointer when deallocating the returned array.
>
> However, what I don't know how to do yet is to also tell the Gc that  
> the
> original value should not be deallocated until we have finished  
> dealing with
> the returned bigarray.
>
> Is there a clean way to do that ?

I'm not sure I understand what you want to do (what is the original  
value ?).

1) If you are wondering about the original data of the allocated big  
array then there is no such data if you use alloc_bigarray with  
BIGARRAY_EXTERNAL.
2) If you are wondering about how you could deallocate the C pointer  
using your own function whenever the bigarray becomes unreachable then  
register the bigarray with Gc.finalise and an appropriate function.

Best,

Daniel