Does newByteArray clear?
Bertram Felgenhauer
bertram.felgenhauer at googlemail.com
Thu Aug 27 00:56:29 UTC 2020
David Feuer wrote:
> I'm looking to play around with an array-based structure with
> sub-linear worst-case bounds. Array is pretty awkward in that context
> because creating a new one takes O(n) time to initialize it. Is that
> all true of newByteArray, or can I get one with arbitrary garbage in it
> for cheap?
newByteArray# does not actively clear memory.
However, for large arrays, I think the memory is likely to be freshly
allocated from the OS, and the OS will have cleared it for security
reasons.
Cheers,
Bertram
More information about the Glasgow-haskell-users
mailing list