Skip to content

Memory usage exploding for complex pattern matching

It seems like complex pattern matching is consuming a prohibitive amount of memory. From a discussion in ghc-devs, https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html, the exhaustiveness checker could be the culprit.

We have tried with 7.10.3, 8.0.2, 8.4.1 and ghc-HEAD. They show similar results.

The "-fmax-pmchecker-iterations=0" option seems to help slightly. Bigger cases will run out of memory even with the option enabled.

I'm attaching a "minimal" example to help diagnosing. The majority of the code has been generated by Template Haskell.

Trac metadata
Trac field Value
Version 8.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information