Memory usage exploding for complex pattern matching

Matthew Pickering matthewtpickering at
Thu Mar 29 15:27:10 UTC 2018

You can turn off the pattern match checker, is that an option?

Can you post your code which shows the poor behaviour. It could be
good to profile that part of GHC to see if there are any easy gains
but it is known to be slow.



On Thu, Mar 29, 2018 at 3:16 PM, Victor Miraldo (UU)
<v.cacciarimiraldo at> wrote:
> 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?
> Thanks!!
> Victor
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at

More information about the ghc-devs mailing list