local ByteArrays: performGC do any good?

Peter Tanski p.tanski at gmail.com
Thu Mar 8 00:33:52 EST 2007

Hello Simon and Ian,

Perhaps either of you may be able to answer this question easily:

I am testing the replacement Integer library in Haskell and I wanted  
to copy arrays between the two--I can't do all of that in Haskell  
because the RTS allocation has a maximum alignment of 4 when I need  
16 (sometimes--I might also realign things, as a last resort).  In  
any case, the easy way to do it would be to grab the ByteArray# from  
the Integer (J# Int# ByteArray#), grab the Addr# with the primitive  
byteArrayContents#, turn that into a pointer and pass it to the  
foreign function.  That would be a sketchy move--even for testing-- 
because Integer ByteArrays are local (not pinned).  Do you think  
doing a performGC just before grabbing the Addr# would help?  There  
doesn't seem to be another primitive for marshalling a pointer from a  

Peter Tanski

More information about the Glasgow-haskell-users mailing list