
#8627: mallocForeignPtrBytes documentation unobvious regarding memory alignment -------------------------------------+------------------------------------- Reporter: | Owner: ekmett schernichkin | Status: new Type: bug | Milestone: Priority: normal | Version: 7.6.3 Component: Core | Keywords: Libraries | Architecture: Unknown/Multiple Resolution: | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | Documentation bug | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by ekmett): `mallocForeignPtrBytes` provides no alignment guarantees. You should in theory need to pad your request by `(alignment - 1)` bytes and align the resulting memory by hand. We're missing a `mallocForeignPtrBytesAligned`, which would behave like `allocaBytesAligned` which probably should become a separate issue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8627#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler