Version française
Home     About     Download     Resources     Contact us    
Browse thread
c/OCaml interface question... Bigarray
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gordon Henriksen <gordonhenriksen@m...>
Subject: Re: [Caml-list] c/OCaml interface question... Bigarray
On 2008-04-05, at 16:46, Andrew I. Schein wrote:

> I have been looking at the Bigarray code to figure out how it  
> works.  I see in the bigarray_get_N function inside  
> bigarray_stubs.c, that there is no use of macro CAMLParam* or  
> CAMLReturn.  How is it that these macros are unnecessary in this code?

These macros allow the garbage collector find and update pointers on  
the stack. Without them, the GC might collect the referenced objects,  
leaving dangling pointers in stack-local variables. The use of these  
macros is unnecessary overhead if (1) the collector cannot be invoked  
from the function (that is, no GC memory is allocated from it) or (2)  
there are no object references kept in parameters or local variables.

— Gordon