[GHC] #9332: Memory blowing up for strict sum/strict foldl in ghci
GHC
ghc-devs at haskell.org
Sat Jul 19 18:00:29 UTC 2014
#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 artella.coding):
OK things are a bit clearer now, but I am still not certain as to whether
it is a bug or not. If we have :
{{{
--Test.hs
module Main (main) where
import Data.List
longList::[Int]
longList = [1 .. ]
result :: Int
result = foldl' (+) 0 $ takeWhile (< 10000000) longList
main = do
print $ result
}}}
Now if we do :
a)First clean all .o and .hi files.
b)Now compile as "ghc Test". This creates .hi and .o files.
c)Now load into ghci via "ghci Test"
d)"longList" is in scope. Therefore unsurprisingly running main blows up.
Now if we do the following :
a)Clean all .o and .hi files.
b)Load into ghci via "ghci -fobject-code Test"
c)Now "longList" is not in scope. This time running main does not blow up.
I think that Orjan was trying to explain this in
http://stackoverflow.com/a/24840786/917635
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9332#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list