[Haskell-cafe] Increasing memory use in stream computation

Arie Peterson ariep
Thu Oct 10 18:05:37 UTC 2013


Hi Claude,


> Looking at the heap profile graph (generated with +RTS -h, no need to
> compile with profiling) I see the increasing memory use is split about
> evenly between STACK and BLACKHOLE.  I don't know what that means or why
> it occurs, but replacing `small` solved that problem for me:
> 
> small = V.fromList <$> S.stream (replicateM 7 [-1,0,0,1])

Interesting!

Unfortunately, my real code is more complicated, and I can't simplify its 
"small" function in this way. (The list [-1,0,0,1], that is being streamed in 
the do block, in the full program depends on some parameter that changes on 
each iteration.)

Although, maybe I can do all the logic of the "small" function in the list 
monad, and stream the resulting list, as you do in the above.





More information about the Haskell-Cafe mailing list