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

>> 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:

You misunderstood: I did not say that those megabytes are available
to malloc.  I just pointed out that it's a similar phenomenon to the one
that takes place with malloc.

> But, if you need to allocate something else, you will need
> more memory.

But the objects are still usable: there is still a pointer to them
somewhere and some sequence of events can bring Emacs to a state where
those objects are used again.  So it is not strictly speaking a leak, in
my book.

Also, I'm curious how you bumped into this problem.  Was it by looking
at the code, or was it in "real life use", or in some test you happened
to be running?

The fact that the wasted memory doesn't grow indefinitely, and only
grows with the fonts actually used, makes me think that it shouldn't be
a problem in real life usage.

>> 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.

So it'd be better to merge the two.


        Stefan



      reply	other threads:[~2013-10-25  0:41 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
2013-10-25  0:41     ` Stefan Monnier [this message]

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=jwvbo2ejij3.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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.