Memory usage exploding for complex pattern matching

Victor Miraldo (UU) v.cacciarimiraldo at
Thu Mar 29 14:16:26 UTC 2018

Dear ghc-devs,

We are working on a library and came across quite high memory consumption
when compiling some code (generated by TH).

This memory issue seems to come from the exhaustiveness checker as
we found in:

We came up with a "minimal" example that at least is self contained and
triggers the problem; `runghc Minimal.hs` should finish with about 5GB of RAM.

Our actual non-minimal scenario runs out of memory on a 16GB RAM machine.

We tried with ghc 8.4.2, 8.0.2 and 7.10.3 and ghc-HEAD; all of those showed
a similar problem, although the older ghc's used less memory.

Do you have any suggestions to make our code finish compiling without running
out of memory?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Minimal.hs
Type: text/x-haskell
Size: 47202 bytes
Desc: Minimal.hs
URL: <>

More information about the ghc-devs mailing list