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
[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: 2004-07-23 (22:01)
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)

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: