ghc: out of memory error while compiling huge "let"

David Morse dcmorse at gmail.com
Fri Jan 12 12:32:47 EST 2007


I have a machine-generated source-code file that brings my computer to
its knees with ghc-6.6.  After an hour or so of rummaging around, ghc
dies with: "ghc-6.6: out of memory (requested 1048576 bytes)".  The
linux machine has 1gb RAM and 2gb swap, and I don't have access to a
better one.

The file is of the form
-------------------------------------------
module foo (a,b) where

(a,b) = let ...10,300 bindings... ; in ([a1,a2,a3...a300],[b1,b2,b3...b10000])
--------------------------------------------

Is there some simple syntactic refactoring I can do to make this work?
 E.g. busting the local bindings out of the "let" and into to the
global level?

The bindings are intertwined, but I could (with some effort) reorder
them so that b5000 would only reference b5001...b10000 and never
b1...b4999.


More information about the Glasgow-haskell-users mailing list