[Nix-dev] GHC "unable to decommit memory"

Thomas Tuegel ttuegel at gmail.com
Thu Sep 1 00:58:37 CEST 2016


Hello nix-dev!

If you're a Haskell user and run NixOS unstable or newer, by now you
have probably seen the message:

"unable to decommit memory: Invalid argument"

coming from GHC-built programs. The short version is, you need the
latest Linux kernel; try with

  boot.kernelPackages = pkgs.linuxPackages_latest;

in your configuration.nix.

The long version of the story [1] is that Linux 4.5 added a feature
present in other Unixy systems for some time (MADV_FREE). The NixOS
default glibc is currently newer than that, so it advertises MADV_FREE
and GHC will use it. But, the default kernel in NixOS is Linux 4.4 at
the moment, where the MADV_FREE isn't supported.

Hope this helps,
Thomas

[1]. https://ghc.haskell.org/trac/ghc/ticket/12495


More information about the nix-dev mailing list