
On 03/06/2010 07:29, Evan Laforge wrote:
On Sun, May 30, 2010 at 5:15 PM, Antoine Latter
wrote: Hi GHC,
Is there a reason that Foreign.Marshall.Array.allocaArray calls into allocaBytes instead of allocaBytesAligned? Since alloca needs the alignment, wouldn't allocaArray also need it?
I'm not too up on how memory access is supposed to work, it was just something that jump out at me.
I've been waiting for a response on this, because I'm curious too, in fact I always have been. At the upgrade to 6.10, ghc suddenly started using 'alignment' and all my programs which had defined it to 'undefined' since I didn't know what alignment was for and it didn't seem to be used, started crashing. So I dug around, dug up the '#let alignment' macro boilerplate, and copy and pasted it around.
However, at the same time, my program started rarely but consistently crashing with an assertion failure from the gc runtime. I'm suspicious of the inconsistent use of alignment, but it's hard to use allocaBytesAligned since it's not exported, and the ffi lib is part of ghc and it's not obvious how to modify it.
Here's the ticket: http://hackage.haskell.org/trac/ghc/ticket/2917 Lennart's patch added allocaBytesAligned to Foreign.Marshal.Alloc, but we'll have to do a library proposal to add that. If you can reproduce the assertion failure, please submit a bug report. Cheers, Simon