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

GHC ghc-devs at haskell.org
Sat Jul 19 12:54:20 UTC 2014


#9332: Memory blowing up for strict sum/strict foldl in ghci
-------------------------------------+-------------------------------------
              Reporter:              |             Owner:
  artella.coding                     |            Status:  new
                  Type:  bug         |         Milestone:
              Priority:  normal      |           Version:  7.8.3
             Component:  GHCi        |          Keywords:  ghci, strict,
            Resolution:              |  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:              |
-------------------------------------+-------------------------------------
Description changed by artella.coding:

Old description:

> (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.

New description:

 (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.

--

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


More information about the ghc-tickets mailing list