Memory usage exploding for complex pattern matching

Victor Miraldo (UU) v.cacciarimiraldo at uu.nl
Thu Mar 29 16:12:09 UTC 2018


Hello Ben,


>> 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.
>>
> Hmm, with 8.2 I'm seeing a peak memory usage of 3.5 GB, with that peak
> occurring during renaming, not desugaring (when exhaustiveness checking
> happens). Are you certain that the exhaustiveness checker is the
> responsible party?

Not at all! In fact, I ran some comparisons with "-ddump-phases" and
plotted those.
I'm attaching the graphs here. From base to "added E" we added 16 more
pattern matches,
then each "added" phase is an additional 16 pattern matches. The
simplifier stands out there.

I couldn't run a bigger case as I had hit the ceiling of my machine.

Cheers,
Victor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SpacePerPhase.png
Type: image/png
Size: 48865 bytes
Desc: SpacePerPhase.png
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180329/e397d21c/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TimePerPhase.png
Type: image/png
Size: 46136 bytes
Desc: TimePerPhase.png
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180329/e397d21c/attachment-0003.png>


More information about the ghc-devs mailing list