Justin Raymond
Justin Raymond

Reputation: 3568

Does Haskell's `Data.Vector.Mutable.unsafeNew` zero the memory?

The docs says that new "creates a mutable vector of the given length" and unsafeNew "creates a mutable vector of the given length. The length is not checked."

However this resolved github issue indicates that unsafeNew does not zero the memory while new does.

Which one is it?

Upvotes: 3

Views: 74

Answers (1)

jberryman
jberryman

Reputation: 16645

No, not in general. If you click through the source this is pretty clear:

https://hackage.haskell.org/package/vector-0.11.0.0/docs/src/Data-Vector-Generic-Mutable.html#new

new is unsafeNew with the addition of basicInitialize.

Upvotes: 3

Related Questions