Skip to content

mallocBytes allows underflow

https://hackage.haskell.org/package/base-4.10.1.0/docs/src/Foreign.Marshal.Alloc.html#mallocBytes

This function doesn't complain when passed a negative number. Instead you get something like

*** Exception: malloc: resource exhausted (out of memory)

Which is confusing, and probably not consistent across platforms.

This came up in https://github.com/tel/saltine/issues/42

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information