Have you tried to compile your code with optimisations? I guess GHC's
strictness analysis would find strict evaluation is better here.
2012/1/30 Joey Hess j...@kitenet.net
Claude Heiland-Allen wrote:
Control.Monad.State.Strict is strict in the actions, but the state
itself is still lazy,
Yves Parès wrote:
Have you tried to compile your code with optimisations? I guess GHC's
strictness analysis would find strict evaluation is better here.
The original code I saw this happen to the wild was built with -O2.
I didn't try building the test case with optimisations.
--
see shy jo
The attached test case quickly chews up hundreds of MB of memory.
If modified to call work' instead, it runs in constant space.
Somehow the value repeatedly read in from the file and stored in
the state is leaking. Can anyone help me understand why?
(ghc 7.0.4)
--
see shy jo
{-# LANGUAGE
Hi,
On 30/01/12 01:07, Joey Hess wrote:
The attached test case quickly chews up hundreds of MB of memory.
If modified to call work' instead, it runs in constant space.
Somehow the value repeatedly read in from the file and stored in
the state is leaking. Can anyone help me understand why?
Claude Heiland-Allen wrote:
Control.Monad.State.Strict is strict in the actions, but the state
itself is still lazy, so you end up building a huge thunk in the
state containing all the updates that ever took place to the initial
state.
Using this should fix it:
modify' :: MonadState s m