From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Initial frame faces
Date: Mon, 27 Jan 2014 18:03:40 +0200 [thread overview]
Message-ID: <83ha8p9ztv.fsf@gnu.org> (raw)
In-Reply-To: <52E62C34.1020209@yandex.ru>
> Date: Mon, 27 Jan 2014 13:51:48 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: emacs-devel@gnu.org
>
> On 01/24/2014 01:08 PM, Eli Zaretskii wrote:
>
> > But perhaps we should step back a notch and discuss the original
> > problem. What problem(s) did you want to solve, exactly?
>
> The problem is that free_frame_faces is never called when an initial
> frame is deleted. With valgrind, this is reported as memory leak:
>
> ==19033== 12,088 (40 direct, 12,048 indirect) bytes in 1 blocks are definitely lost in loss record 11,087 of 11,232
> ==19033== at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==19033== by 0x5E1179: xmalloc (alloc.c:677)
> ==19033== by 0x51B43A: make_face_cache (xfaces.c:4202)
> ==19033== by 0x512D36: init_frame_faces (xfaces.c:666)
> ==19033== by 0x428442: make_initial_frame (frame.c:576)
> ==19033== by 0x4BA3ED: init_window_once (window.c:7096)
> ==19033== by 0x565B01: main (emacs.c:1201)
>
> IIUC this may be fixed in three ways:
>
> 1) If an initial frame is never used to display anything,
> we don't need faces on that frame at all.
>
> 2) initial_terminal should have a hook to free faces on an initial frame.
>
> 3) If each frame always has a face cache, it's reasonable to call
> free_frame_faces in delete_frame and not in frame type-specific hooks.
I think 2) is the best, because it leaves the possibility of having a
different delete_frame_hook for each terminal type (although they seem
to be identical for now). free_frame_faces already defends itself
against a NULL cache (actually, it over-defends itself, as all of its
subroutines check that as well), so it should be safe to call it from
initial_terminal's hook, even if the face cache is not initialized in
some situation.
prev parent reply other threads:[~2014-01-27 16:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-24 6:02 Initial frame faces Dmitry Antipov
2014-01-24 7:53 ` Eli Zaretskii
2014-01-24 8:38 ` Dmitry Antipov
2014-01-24 9:08 ` Eli Zaretskii
2014-01-27 9:51 ` Dmitry Antipov
2014-01-27 16:03 ` Eli Zaretskii [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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83ha8p9ztv.fsf@gnu.org \
--to=eliz@gnu.org \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).