<br><br><div class="gmail_quote">2010/6/13 Don Stewart <span dir="ltr"><<a href="mailto:dons@galois.com">dons@galois.com</a>></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">> Hello,<br>
> I'm trying to allow RGB images as buttons in XMonad. It's alreasy working, but<br>
> now XMonad leaks a lot of memory (each time you change focus about 1 or 2<br>
> megabytes are taken from memory), so when a little time passes, it becomes<br>
> unusable. I'd like to ask for help profiling or with any other thing that may<br>
> help me solve this problem.<br>
><br>
> As of now, I'm saving the images as String. Then, using<br>
> Foreign.C.String.newCAString, I convert it to a CString, which is what Xlib<br>
> expects. After that, I create a Image using XCreateImage, which I paint using<br>
> XPutImage. Finally, I call XDestroyImage to free the memory. So, as far as I<br>
> 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 'xmonad --recompile'?</div>
</div><br>