Skip to content

Does UnliftedFFITypes keep ByteArray#s alive?

Summary

Location of documentation issue: GHC user's guide

As part of an ongoing discussion at this bytestring pull request, the question arose: When passing a pinned ByteArray# to a safe foreign function import with the UnliftedFFITypes extension, is the runtime allowed to garbage-collect the ByteArray# object in question before the FFI call is complete?

Proposed improvements or changes

The answer to this question should be easy to find in the GHC user's guide section on UnliftedFFITypes.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information