<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On May 16, 2012, at 12:08 PM, Yves Parès wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">The buffer <a href="http://hpaste.org/68595">http://hpaste.org/68595</a> presents a simple code I tried to profile.<br>I spotted what I strongly think to be an abusive memoization. The problem is that I don't see how to (simply) get rid of it.<br>

Compiled with -O2, it consumes 130MB of memory, however lines A and B executed separately consume each only 1MB.<br><br>The infinite list (l 1), whatever I do, keeps being shared between lines A and B.<br>I tried to wrap it in a function, as you can see, I also tried to make it explicitely polymorphic (bypassing monomorphic restriction), nothing solves it, GHC is just to good at memoizing.<br></blockquote><br></div><div>Adding a {-# NOINLINE l #-} annotation helps here. Syntactically, it must be located somewhere a type signature for l would also be valid.</div><div><br></div><div>Anthony</div><br></body></html>