From: Dmitry Antipov <dmantipov@yandex.ru>
To: Emacs development discussions <emacs-devel@gnu.org>
Subject: Initial frame faces
Date: Fri, 24 Jan 2014 10:02:21 +0400 [thread overview]
Message-ID: <52E201ED.1080108@yandex.ru> (raw)
Do we really need faces on an initial frame? IIUC this frame has nothing
to display and so face information is useless. Moreover, when the first
'real' (TTY or window system) frame is created, initial frame is deleted
but free_face_cache is never called for it, thus creating 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)
We can avoid creating face cache for initial frame with an
extra check in Fdisplay_supports_face_attributes_p, i.e.:
=== modified file 'src/frame.c'
--- src/frame.c 2014-01-11 10:01:01 +0000
+++ src/frame.c 2014-01-24 05:38:56 +0000
@@ -572,9 +572,6 @@
/* The default value of menu-bar-mode is t. */
set_menu_bar_lines (f, make_number (1), Qnil);
- if (!noninteractive)
- init_frame_faces (f);
-
last_nonminibuf_frame = f;
return f;
=== modified file 'src/xfaces.c'
--- src/xfaces.c 2014-01-01 07:43:34 +0000
+++ src/xfaces.c 2014-01-24 05:39:55 +0000
@@ -5046,6 +5046,13 @@
CHECK_LIVE_FRAME (frame);
f = XFRAME (frame);
+ /* Initial frame has no faces. */
+ if (FRAME_INITIAL_P (f))
+ {
+ eassert (FRAME_FACE_CACHE (f) == NULL);
+ return Qnil;
+ }
+
for (i = 0; i < LFACE_VECTOR_SIZE; i++)
attrs[i] = Qunspecified;
merge_face_ref (f, attributes, attrs, 1, 0);
Dmitry
next reply other threads:[~2014-01-24 6:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-24 6:02 Dmitry Antipov [this message]
2014-01-24 7:53 ` Initial frame faces 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
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=52E201ED.1080108@yandex.ru \
--to=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.