emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initial frame faces


From: Eli Zaretskii
Subject: Re: Initial frame faces
Date: Mon, 27 Jan 2014 18:03:40 +0200

> Date: Mon, 27 Jan 2014 13:51:48 +0400
> From: Dmitry Antipov <address@hidden>
> CC: address@hidden
> 
> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]