[Haskell-cafe] Memory Management and Lists

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Wed Jul 13 18:00:12 UTC 2016


On Tue, Jul 12, 2016 at 07:28:05PM -0800, Christopher Howard wrote:
> After pondering this problem some more, I found a solution to the
> problem was to introduce strictness, not deep down in the StateReader
> monad, but rather at the top level, i.e., forcing evaluation of each
> Matrix as soon as it is pulled of the list of Matrices. I found I could
> do this simply by summing all the elements in each matrix and printing
> the sum to std out. With this approach, i successfully run the full
> program and never even saw my memory performance graph move up.
> 
> I suppose there might be a way to do the same thing more efficiently
> with seq...?

Undoubtedly, but it's customary when asking for help to produce a complete
minimal example that reproduces the problem.  I can't help if I can't run
your code!


More information about the Haskell-Cafe mailing list