I'm curious: how does the RTS achieve this "retroactive" pinning? The documentation at
https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC/Pinned suggests that
all ByteArrays are allocated pinned to account for the possibility that they will in future be passed to the FFI. Is this really the case? This seems like it forces an unreasonably slow allocator on small (say, ~10-byte) ByteArray allocations where the GC's usual bump-pointer allocator might otherwise be preferable.