<br><br><div class="gmail_quote">2010/6/13 Don Stewart <span dir="ltr">&lt;<a href="mailto:dons@galois.com">dons@galois.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

trupill:<br>
<div><div></div><div class="h5">&gt; Hello,<br>
&gt; I&#39;m trying to allow RGB images as buttons in XMonad. It&#39;s alreasy working, but<br>
&gt; now XMonad leaks a lot of memory (each time you change focus about 1 or 2<br>
&gt; megabytes are taken from memory), so when a little time passes, it becomes<br>
&gt; unusable. I&#39;d like to ask for help profiling or with any other thing that may<br>
&gt; help me solve this problem.<br>
&gt;<br>
&gt; As of now, I&#39;m saving the images as String. Then, using<br>
&gt; Foreign.C.String.newCAString, I convert it to a CString, which is what Xlib<br>
&gt; expects. After that, I create a Image using XCreateImage, which I paint using<br>
&gt; XPutImage. Finally, I call XDestroyImage to free the memory. So, as far as I<br>
&gt; know, no leak should be possible :(<br>
<br>
</div></div>You should recompile xmonad with --enable-executable-profiling -ghc-options=-auto-all<br>
and then run it with +RTS -p<br>
<br>
This will create a .prof file that will tell you what is allocating.<br>
<br>
For even clearer understanding, use heap profiling, which will<br>
graphically display what is being allocated and where.<br>
<br>
    <a href="http://book.realworldhaskell.org/read/profiling-and-optimization.html#id678078" target="_blank">http://book.realworldhaskell.org/read/profiling-and-optimization.html#id678078</a><br>
<font color="#888888"><br></font></blockquote><div><br></div><div>Thanks very much. Just one more question: do I have to change anything when compiling xmonad and xmonad-contrib, or just use those arguments when calling &#39;xmonad --recompile&#39;?</div>

</div><br>