Effect of large binaries on garbage collection
Adrian Hey
ahey@iee.org
Mon, 10 Mar 2003 10:51:20 +0000
On Thursday 06 March 2003 10:55, Adrian Hey wrote:
> On Tuesday 04 March 2003 12:36, Simon Peyton-Jones wrote:
> > GHC does not copy big objects, so don't worry about the copying cost.
> > (Instead of copying, it allocates big objects to (a contiguous series
> > of) heap blocks, with no other objects in those blocks. Then the object
> > can "move" simply by swizzling the heap-block descriptor.)
>
> Thanks, looks like it's option (1) then. Could you tell me what
> Haskell type I have to use be able to pass a pointer to this binary
> to C land (genuine address, not StablePtr). I don't think
> the standard FFI allows this at all but, IIRC, the old ghc libraries
> allowed you to do this with a mutable byte array.
Does anybody know the answer to this? please.. pretty please..:-)
Sorry if this is a case of me failing to RTFM, but I don't
think it is. Paragraph 8.1.1 of the users guide says..
"The types ByteArray and MutableByteArray may be used as basic
foreign types (see FFI Addendum, Section 3.2). In C land,
they map to (char *)."
I can't find any way in the Base libs (or what's left of the old
libs) to create a ByteArray or MutableByteArray, which leads me to
suspect that they no longer exist.
Should I use something else instead?
Thanks
--
Adrian Hey