[Haskell-cafe] Slow IO

Udo Stenzel u.stenzel at web.de
Wed Sep 13 05:01:17 EDT 2006

Ketil Malde wrote:
> Daniel Fischer <daniel.is.fischer at web.de> writes:
> > Maybe I've misused the word segfault.
> I think so.  A segfault is the operating-system complaining about an
> illegal memory access.  If you get them from Haskell, it is likely a
> bug in the compiler or run-time system (or you were using unsafeAt, or
> FFI). 

Far simpler:  This is really a segfault, and it's because of a
misfeature of Linux called "memory overcommitment".  When physical
memory runs out, Linux happily hands out more to applications requesting
it, in the vain hope that at least some of it is never accessed.
Therefore, malloc() is always successful, but when the memory is finally
accessed, it suddenly turns out that there isn't anything to access,
which results in a segfault.  No amount of error checking can prevent
that and it could have hit any process allocating memory when it ran

Sane people turn overcommitment off.  Sane people wouldn't have
implemented it in the first place, either.

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man. 
    -- George Bernard Shaw
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20060913/b7ce6d31/attachment.bin

More information about the Haskell-Cafe mailing list