Ticket #3800 (closed bug: fixed)
sizeofByteArray# returns allocated words, not requested length in bytes
| Reported by: | AntoineLatter | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | 7.0.1 |
| Component: | Compiler | Version: | 6.12.1 |
| Keywords: | Cc: | aslatter@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Incorrect result at runtime | Difficulty: | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
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.
See also: http://www.haskell.org/pipermail/glasgow-haskell-users/2009-December/018199.html
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

