all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: Memory leaks in font objects
Date: Thu, 24 Oct 2013 19:49:20 +0400	[thread overview]
Message-ID: <52694180.2070708@yandex.ru> (raw)
In-Reply-To: <jwvmwlylqyc.fsf-monnier+emacs@gnu.org>

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, byte-force-recompile
should reuse a lot of memory - so why +65M? But, 2nd run of bloat-font do not add
too much. Why? Consider XLoadQueryFont example. When you do not call XFreeFont but
just lost XFontStruct pointer, the font is still allocated by Xlib. Since you lost
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 you
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.

Dmitry




  reply	other threads:[~2013-10-24 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24  6:31 Memory leaks in font objects Dmitry Antipov
2013-10-24 14:19 ` Stefan Monnier
2013-10-24 15:49   ` Dmitry Antipov [this message]
2013-10-25  0:41     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52694180.2070708@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.