Opened 18 months ago

Last modified 17 months ago

#14988 new bug

Memory strain while compiling HLint

Reported by: mcandre Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.2
Keywords: Cc:
Operating System: FreeBSD Architecture: x86_64 (amd64)
Type of failure: Compile-time performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


I want to setup a build bot for generating Haskell binaries in an automated fashion, however even with 4 GB of RAM, cabal is unable to build HLint in HardenedBSD. Specifically, GHC is choking on mmap errors while compiling HLint's huge dependency tree.

Can we somehow shrink the massive memory usage of GHC, so that common packages HLint can be built on medium-low build bots? Imagine GHC running on a RaspberryPi: You're gonna have a bad time.

Change History (3)

comment:1 Changed 18 months ago by mcandre


The specific error I'm getting is

$ cabal install HLint
ghc: mmap 131072 bytes at 0x0: Operation not permitted

This happens in HardenedBSD, does not happen in FreeBSD. This happens when ghc tries to build HLint's haskell-src-exts, uniplate, and/or aeson dependency libraries. This does not happen in HardenedBSD for smaller package trees like shake or QuickCheck.

I tried adding swap space to provide a larger memory pool, but top showed cabal/ghc never dipping into swap space, so I suppose this mmap error means something else besides out-of-memory.

comment:2 Changed 18 months ago by mcandre

I'm using ghc v8.0.2, cabal-install v1.24.0.2.

comment:3 Changed 17 months ago by bgamari

Have you tried compiling with -O0? This may help memory consumption considerably.

Note: See TracTickets for help on using tickets.