
#9332: Memory blowing up for strict sum/strict foldl in ghci -------------------------------------+------------------------------------- Reporter: | Owner: artella.coding | Status: closed Type: bug | Milestone: 7.8.4 Priority: high | Version: 7.8.3 Component: GHCi | Keywords: ghci, strict, Resolution: fixed | memory Differential Revisions: | Operating System: Linux Architecture: x86_64 | Type of failure: Runtime (amd64) | performance bug Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | -------------------------------------+------------------------------------- Comment (by nomeata): Not a bug. `longList` is a CAF (e.g. a global not-yet-evaluated constant). When you load it in GHCi and evaluate result, GHC doesn’t know whether you are going to use `longList` again, and has to keep it in memory. But if you compile it is a program, or as a module only exporting `main`, GHC will make `longList` a local definition that, after the evaluation of `Result` is started, can be garbage collected. (With `-O` it will probably fuse it away even, but that is unrelated here.) But thanks for reporting! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9332#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler