Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Bigarray is a pig
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David McClain <dmcclain1@m...>
Subject: Re: [Caml-list] Bigarray is a pig
Sorry for letting my mind run ahead of my typing...

What I meant to say previously about danger, is that despite the foreign
arrays being safe from GC disruption, in order to access the arena of these
arrays you have to trick OCaml into believing that it is seeing one of its
own kind of array.

That arena address is a foreign pointer address, but this is potentially
unsafe in the face of GC because the foreign array does not actually have
the require structure to pass as an OCaml array of float. So you have to
take care never to allocate anything in the heap during arena accessing.

That is also why the only permitted access to the array arena is by means of
unsafe_get and unsafe_put. You have to be unsafe to be safe... er, yeah...
But it is very fast! It compile to direct memory reference inside the loops.

David McClain
Senior Corporate Scientist
Avisere, Inc.

+1.520.390.7738 (USA)
david.mcclain@avisere.com



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners