Memory usage exploding for complex pattern matching

Victor Miraldo (UU) v.cacciarimiraldo at uu.nl
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:
https://ghc.haskell.org/trac/ghc/ticket/11163
https://ghc.haskell.org/trac/ghc/ticket/11195

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Minimal.hs
Type: text/x-haskell
Size: 47202 bytes
Desc: Minimal.hs
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180329/468318d3/attachment.hs>


More information about the ghc-devs mailing list