Updates to FFI spec

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Fri Sep 13 09:36:45 EDT 2002


Alastair:
>> (In the image processing example, images were megabytes and an
>> expression like (x + (y * mask)) would generate 2 intermediate
>> images (several megabytes) while doing just 2 reductions in
>> Haskell.)

Marcin:
> OCaml allows the programmer to specify an approximate amount of
> foreign memory in its wrapped C pointers. Maybe it's a good idea?

We did that on the C/C++ side of things so that we could keep track of
how much image memory was in use and try to trigger a GC when the
amount of memory was significantly higher than the running average (or
some such).

I wonder why OCaml would do it on the Caml side?  

Maybe they include similar heuristics but as a standard part of the
system instead of leaving it to each library writer to roll their own?

Or could it control the amount of GC performed?  If you know that all
the objects you care about are in the youngest generation, you could
decide to collect just the youngest generation.  (Except that isn't
always enough - releasing an object in the old generation might
release a pointer into the new generation.)

--
Alastair




More information about the FFI mailing list