[GHC] #9332: Memory blowing up for strict sum/strict foldl in ghci

GHC ghc-devs at haskell.org
Sat Jul 19 10:58:16 UTC 2014


#9332: Memory blowing up for strict sum/strict foldl in ghci
-------------------------------------+-------------------------------------
        Reporter:  artella.coding    |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  GHCi              |                 Version:  7.8.3
        Keywords:  ghci, strict,     |  Differential Revisions:
  memory                             |            Architecture:  x86_64
Operating System:  Linux             |  (amd64)
 Type of failure:  Runtime           |              Difficulty:  Unknown
  performance bug                    |              Blocked By:
       Test Case:                    |         Related Tickets:
        Blocking:                    |
-------------------------------------+-------------------------------------
 (http://stackoverflow.com/questions/24838982/memory-blowing-up-for-strict-
 sum-strict-foldl-in-ghci)

 Suppose we have

 {{{
 --Test.hs
 import Data.List

 longList::[Int]
 longList = [1 .. ]

 result :: Int
 result = foldl' (+) 0 $ takeWhile (< 10000000) longList

 main = do
   print $ result
 }}}

 If one deletes all the ".hi" and ".o" files and then loads into ghci via :

 {{{
 ghci -fobject-code Test.hs
 }}}

 then upon running "main" the memory blows up.

 However if one first compiles via :

 {{{
 ghc Test.hs
 }}}

 and then subsequently loads into ghci via :

 {{{
 ghci Test.hs
 }}}

 then upon running "main" the memory does not blow up.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9332>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list