On Mon, 13 Nov 2006, Donald Bruce Stewart wrote:

> And for custom data (not just C strings), if the withCString* functions
> don't quite fit, you can always pack the foreign Ptr into a ByteString
> by stepping inside the ByteString constructor:
> 
>     http://www.haskell.org/haskellwiki/Wc#Going_via_C

That's actually what I tried first, but in this particular situation
(ghc-6.4.1 / fps-0.7), PS apparently isn't exported?

The CStringLen approach works, except that the allocated data doesn't
get garbage-collected.  Just for the sake of experiment I tried a regular
CString with packMallocCString, and that didn't leak nearly as much memory -
but still some, in a simple loop where "pack" doesn't leak anything.

Thanks,
        Donn Cave, [EMAIL PROTECTED]

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to