使用GHC编译时内存不足

时间:2018-10-11 19:11:06

标签: haskell ghc haskell-stack

我最近将我的应用程序升级到了GHC 8.4,并试图将其部署到生产环境中。不幸的是,当我尝试在持续集成服务器上编译该应用程序时,每次都会耗尽内存。 (多年来,此应用程序一直在该相同服务上进行编译,而没有出现问题。)是否有任何方法可以配置GHC / Stack以使编译使用的资源更少?可以,这样会使编译速度变慢。

对于上下文,这是编译器崩溃的地方:

Progress 171/271: aeson-1.2.4.0                               aeson-1.2.4.0: copy/register
Progress 171/271: aeson-1.2.4.0                               Progress 172/271

--  While building custom Setup.hs for package Cabal-2.2.0.1 using:
      /root/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure (-9) (THIS MAY INDICATE OUT OF MEMORY)

ETA:该问题已被标记为Cabal install criterion out of memory的重复项,但不幸的是,该解决方案无济于事。如果我将stack build更改为stack build --ghc-options '+RTS -M1500M -RTS',那似乎只会使崩溃发生的时间更早:

Cabal-2.2.0.1: copy/register
Progress 171/271: Cabal-2.2.0.1                               Progress 172/271

--  While building custom Setup.hs for package tzdata-0.1.20180501.0 using:
      /root/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure (-9) (THIS MAY INDICATE OUT OF MEMORY)

0 个答案:

没有答案
相关问题