Eli Zaretskii writes: > This doesn't seem to be a leak in itself. Hi. I'm fairly certain that this is the leak. I know I didn't show any evidence to that effect earlier, but I simply haven't written it up yet. Doing that now. Note that the attached scripts aren't particularly nice; they were quickly whipped up to solve a problem. Procedure: 0. Preliminaries. I built my own emacs with -fno-omit-frame-pointer. I'm using the lucid X11 widgets. I'm on Debian/sid and the split debug symbols are available. I patched my perf to be able to find these split debug symbols: http://lkml.iu.edu/hypermail/linux/kernel/1509.0/04006.html 1. Set up emacs to continually leak memory. Here I do that by running 'emacs -Q --daemon'. Then "emacsclient -a '' -c" to open a frame. Then in a loop open/destroy a second frame: while true; do timeout 1 emacsclient -a '' -c; sleep 1; done This is described in earlier emails. As this goes I can observe the memory leak: while (true) { ps -h -p `pidof emacs` -O rss; sleep 1 } | awk '{print $2;}' A snapshot of this is attached in memory.log, and plotted in memory.pdf: script This makes a human-readable, but even larger file. Way too big; definitely not attaching it. 4. Analyze. Note that the emacs client loop creates a client for 1 second, then kills it and waits 1 more second. So there's a new client every 2 seconds. I "perf record" for 40 seconds, so ~ 20 new clients were created in that time. I now run the script file through parse_script.pl to follow all allocations, and report any that have not been freed. Anything that has been allocated at the start of the log file, and hasn't been freed by the end is potentially a leak. Attaching a "leaks" file that's the result of this. I make a plot of leak size vs line number: follow4096 Looking at the follow4096 file I see that most of the 4k allocs have the backtrace in the previous email. None of these are ever freed. Some of the 4k allocs touch the menu stuff, and those are all freed (in garbage_collect, so the gc IS being called). Some of the 4k allocs are from the tool bar, and those all leak too, but there aren't as many of them as the font ones. So this tells me that the backtrace in the previous email is the main one causing the leak. There's more stuff to look at however, like the toolbar stuff and a suspicious 16384 byte alloc, but those aren't as significant as this 4k one.