Ticket #3800 (closed bug: fixed)
sizeofByteArray# returns allocated words, not requested length in bytes
|Reported by:||AntoineLatter||Owned by:|
|Type of failure:||Incorrect result at runtime||Difficulty:|
|Test Case:||Blocked By:|
Description (last modified by igloo) (diff)
A byte array allocated with (GHC.Prim.newByteArray# 7) will report it's size as '8' - that is, the stored size in StgArrWords is the number of allocated words, not the number of requested bytes.
This menas that if I want to a GHC.Prim.ByteArray# or MutableByteArray# as an array type, I need a separate length fields.