Eventually, I don&#39;t think it is a profiling issue.<br>Maybe a problem with integral. According to a quite recent post on the reactive mailing list, the following minimal code produces the same problem :<br><br><pre>&gt; import FRP.Reactive<br>
&gt; import FRP.Reactive.LegacyAdapters<br><br>&gt; import Control.Applicative<br><br>&gt; type Velocity = Double<br>&gt; type Position = Double<br><br>&gt; data Car = Car { vel :: Velocity, pos :: Position } deriving Show<br>
<br>&gt; velocity :: Behavior Velocity<br><br>&gt; velocity = 1<br><br>&gt; position :: Behavior Position<br>&gt; position = integral (atTimes [0, 0.5 ..]) velocity<br><br>&gt; car :: Behavior Car<br>&gt; car = Car &lt;$&gt; velocity &lt;*&gt; position<br>
<br><br>&gt; main :: IO ()<br>&gt; main = adaptE $ print &lt;$&gt; car `snapshot_` atTimes [0, 0.5..]<br><br>&gt; 1) why is the leak happen?<br>&gt; 2) how can I fix this problem?<br><br>&gt; Some more detailed informations:<br>
<br>&gt; * reactive 0.11.4<br>&gt; * GHC 6.12.1<br>&gt; * Gentoo Linux (2.6.32-tuxonice, x86_64) or Ubuntu 9.10 64bits<br>&gt; * compiled with or without -O2 flag</pre><br><br><div class="gmail_quote">2010/5/16 David Leimbach <span dir="ltr">&lt;<a href="mailto:leimy2k@gmail.com">leimy2k@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br><div class="gmail_quote"><div class="im">On Sat, May 15, 2010 at 8:42 AM, Limestraël <span dir="ltr">&lt;<a href="mailto:limestrael@gmail.com" target="_blank">limestrael@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Okay,<br>guess I&#39;ll have to bring out the chapter 25 of my Real World Haskell...<br></blockquote><div><br></div></div><div>I find it&#39;s often the most practical chapter that I hit a lot during writes and changes to my server process I have in Haskell in our control system code :-)</div>

<div><br></div><div>That plus the information that I had missed that Control.Monad.State defaulted to the Lazy version (which is consistent, but for some reason it got by me) helped me to realize why I was leaking so much space in a garbage collected environment.  </div>

<div><br></div><div>I wouldn&#39;t have gotten very far with Haskell as this piece of our code without that chapter.  I&#39;d love to see more writing of that sort around Haskell in book form.  One can become fluent in tuning Haskell by trial and error, but the sharp corners one must bump into are often sharper than in other languages I&#39;ve found.</div>

<div><br></div><div>Dave</div><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br><br><div class="gmail_quote">
2010/5/15 Bulat Ziganshin <span dir="ltr">&lt;<a href="mailto:bulat.ziganshin@gmail.com" target="_blank">bulat.ziganshin@gmail.com</a>&gt;</span><div>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello Limestraėl,<br>
<div><br>
Saturday, May 15, 2010, 7:02:38 PM, you wrote:<br>
<br>
&gt; But when I set my beat to tick every 60 times per second, the<br>
&gt; position is well updated, but I clearly see that the display<br>
&gt; dramatically slows down after a few seconds of execution. Too heavy rate for integrate?<br>
<br>
</div>it may be due to lot of uncollected garbage that is result of lazy<br>
evaluation. profile program to check its GC times<br>
<font color="#888888"><br>
<br>
--<br>
Best regards,<br>
 Bulat                            mailto:<a href="mailto:Bulat.Ziganshin@gmail.com" target="_blank">Bulat.Ziganshin@gmail.com</a><br>
<br>
</font></blockquote></div></div><br>
<br></div><div class="im">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></div></blockquote></div><br>
</blockquote></div><br>