[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory leaks in font objects

From: Dmitry Antipov
Subject: Re: Memory leaks in font objects
Date: Thu, 24 Oct 2013 19:49:20 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1

On 10/24/2013 06:19 PM, Stefan Monnier wrote:

Oddly enough, I'm not sure it's a leak.  Here's the result of my test:

              VM   RSS
    initial  204    24
    after 1  522   290
    after 2  539   305
    after 3  542   308
    after 4  542   308

So it's more like "once malloced, the memory can be reused by Emacs, but
not by another process because we never return it to the OS".

IIUC no :-(. I tried the following:

initial: 32M RSS
then M-x bloat-font, M-x set-frame-font "fixed", M-x garbage-collect: 372M
then M-x byte-force-recompile [all lisp/ subdir], M-x garbage-collect: 437M

If 372M is (mostly) free but just too fragmented to release, 
should reuse a lot of memory - so why +65M? But, 2nd run of bloat-font do not 
too much. Why? Consider XLoadQueryFont example. When you do not call XFreeFont 
just lost XFontStruct pointer, the font is still allocated by Xlib. Since you 
the pointer, you can't use this font unless you call XLoadQueryFont for the same
font again and got the pointer to previously allocated resource (assuming that 
do not lost the connection to X display). So 2nd, 3rd, etc. calls to bloat-font
will just re-use font resources you lost before. But, if you need to allocate
something else, you will need more memory.

What the difference between "close" and "finalize"?

Nothing except "close" is a part of existing interface which I don't want
to change (at this moment at least), and requires extra frame argument.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]