You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with a project that creates a large immutable long-living structure that unfortunately contains a bunch of Data.ByteStrings. I was hoping to be able to easily reduce GC load by wrapping the creation of this structure with a
fmap getCompact $ compact =<< createStructure
but that of course gives the "Pinned ByteArray# objects cannot be compacted" exception.
I can think of two possible solutions (other than trying to eliminate all bytestrings from the code), but both might add way too much complexity:
Either being aware of the ByteString library specifically and that it is safe to copy in that specific case. (or even just copy the relevant part of the ByteArray#)
Or allowing them to still live outside the compact region, but then the region is no longer actually compact, so it might make it a lot more tricky for the garbage collector?
I guess another option would be to make an unsafe version of the compact function, where you say "trust me, it's safe to copy these pinned ByteArray#".
The text was updated successfully, but these errors were encountered:
I am working with a project that creates a large immutable long-living structure that unfortunately contains a bunch of
Data.ByteString
s. I was hoping to be able to easily reduce GC load by wrapping the creation of this structure with abut that of course gives the "Pinned ByteArray# objects cannot be compacted" exception.
I can think of two possible solutions (other than trying to eliminate all bytestrings from the code), but both might add way too much complexity:
I guess another option would be to make an unsafe version of the
compact
function, where you say "trust me, it's safe to copy these pinned ByteArray#".The text was updated successfully, but these errors were encountered: