garbage collection and other newbie's issues
u.stenzel at web.de
Sun Oct 22 10:41:24 EDT 2006
Andrea Rossato wrote:
> Now, the state will not be entirely consumed/evaluated by the user,
> and so it will not become garbage. Am I right?
No. The state cannot become garbage, because there is still a reference
to it. As long as runStateT has not returned, any part of the state can
still be accessed, so it is not garbage. Completely evaluating the
state will not reduce memory consumption in your case, because the list
of lists won't be substantially smaller that the thunk to create it. In
fact, evaluating this thunk will consume memory.
> Where should I force evaluation?
You can't. Your state really is that large, at least in the toy
example. You'd need a different data structure ((Array Int ByteString)
or (Map Int ByteString) come to mind) and then make that strict.
The Seventh Commandments for Technicians:
Work thou not on energized equipment, for if thou dost, thy
fellow workers will surely buy beers for thy widow and console
her in other ways.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20061022/d4f85bd9/attachment.bin
More information about the Haskell-Cafe