I'm trying to upgrade agda, getting a memory error. Any ways to fix this?
I tried cabal install --ghc-options="+RTS -M600M" --force-reinstalls agda
but per a similair question, but this just gave a heap error.
wmacmil@w:~$ cabal install --force-reinstalls agda
Resolving dependencies...
Warning: The following packages are likely to be broken by the reinstalls:
Agda-2.6.0.1
Continuing even though the plan contains dangerous reinstalls.
Downloading base-compat-0.10.5...
...
[325 of 369] Compiling Agda.TypeChecking.IApplyConfluence ( src/full/Agda/TypeChecking/IApplyConfluence.hs, dist/build/Agda/TypeChecking/IApplyConfluence.o )
[326 of 369] Compiling Agda.TypeChecking.Rules.LHS.Unify ( src/full/Agda/TypeChecking/Rules/LHS/Unify.hs, dist/build/Agda/TypeChecking/Rules/LHS/Unify.o )
cabal: Leaving directory '/tmp/cabal-tmp-30263/Agda-2.6.1'
cabal: Error: some packages failed to install:
Agda-2.6.1 failed during the building phase. The exception was:
ExitFailure (-9)
This may be due to an out-of-memory condition.
Ah, GHC's memory hunger is insaturable...
What I usually do for bigger installs is, hardly limit GHC's -M
(or perhaps to 80% of the total memory), but ensure that it actually has all of this available per-process, by limiting compilation to a single process.
cabal install --ghc-options="+RTS -M7G" -j1 --force-reinstalls agda
Obviously, this makes it all really slow, but at least it'll generally succeed.