Taking too much and Memory overflow while compiling
Summary
I am currently using GHC version 9.4.2 in conjunction with a Haskell program that appears to be experiencing difficulties compiling, potentially due to its non-deterministic nature. Despite my efforts, the program has been consuming an extensive amount of time during compilation, leading to the termination of the process by the operating system. It is worth noting that my machine contains 16 GB of RAM and approximately 16 GB of swap memory.
The program in question is utilizing complex type-level operations. I have been using the following GHC options to facilitate the compilation process: --ghc-options="-O0 -dshow-passes -fsimpl-tick-factor=0 -ddump-simpl
. However, it appears that the compiler has encountered an issue and is currently stuck at the "***Simplifier" stage. please note the memory consumption of Desugar stage (167.558621 GB) as well. after some time OS terminates the process stating that its taking too much momery.
*** Renamer/typechecker [Diurnum.Server]:
!!! Renamer/typechecker [Diurnum.Server]: finished in 68888.49 milliseconds, allocated 10161.548 megabytes
*** Desugar [Diurnum.Server]:
Result size of Desugar (before optimization)
= {terms: 37,569,
types: 1,016,600,
coercions: 209,765,050,
joins: 0/1,770}
Result size of Desugar (after optimization)
= {terms: 26,176,
types: 822,356,
coercions: 228,399,163,
joins: 0/264}
!!! Desugar [Diurnum.Server]: finished in 252049.07 milliseconds, allocated 167558.621 megabytes
*** Simplifier [Diurnum.Server]:
diurnum.zip
Steps to reproduce- unzip it in Nixos
- flake support for Nixos should be enabled
- switch the git branch to
add-pagination-search-sort-in-list
--if not already in it. - nix develop
- cabal run diurnum --ghc-options="-O0 -dshow-passes -fsimpl-tick-factor=0 -ddump-simpl"
Expected behavior
The program should be compiled in minimal time and resources.
Environment
NixOS with flake support
- GHC version used: 9.4.2
Optional:
- Operating System: NixOS
- System Architecture:x86