[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Initial frame faces
From: |
Dmitry Antipov |
Subject: |
Initial frame faces |
Date: |
Fri, 24 Jan 2014 10:02:21 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
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
- Initial frame faces,
Dmitry Antipov <=