[Haskell-cafe] Memory Management and Lists

William Yager will.yager at gmail.com
Wed Jul 13 03:56:23 UTC 2016

You probably want Control.DeepSeq. No extraneous work doing addition that
way either.


On Tue, Jul 12, 2016 at 11:28 PM, Christopher Howard <ch.howard at zoho.com>

> 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...?
> On 07/12/2016 06:39 PM, Christopher Howard wrote:
> > I guess I was hesitating on posting the entire program source code in an
> > cafe email. I suppose I could send you a tarball, if you really wanted
> it...
> >
> > Matrix is from Data.Matrix
> > <http://hackage.haskell.org/package/matrix-
> >.
> >
> > It is hard to understand how thunks alone would explain it... there
> > would be at most 2000 thunks, right? Unless... Could there be a thunk
> > for every single call to getElem? That would be a lot of thunks!
> >
> > Somebody suggested adding some strictness here... could you elaborate on
> > that? I tried inserting seq, but I didn't really understand how I was
> > supposed to use it...
> >
> --
> http://qlfiles.net
> To protect my privacy, please use PGP encryption. It's free and easy
> to use! My public key ID is 0x340EA95A (pgp.mit.edu).
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160712/0a27dfef/attachment.html>

More information about the Haskell-Cafe mailing list