From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Initial frame faces Date: Fri, 24 Jan 2014 10:02:21 +0400 Message-ID: <52E201ED.1080108@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1390543354 25462 80.91.229.3 (24 Jan 2014 06:02:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jan 2014 06:02:34 +0000 (UTC) To: Emacs development discussions Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 24 07:02:41 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W6Zqi-0001eb-Pq for ged-emacs-devel@m.gmane.org; Fri, 24 Jan 2014 07:02:40 +0100 Original-Received: from localhost ([::1]:44564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6Zqi-0008FE-9u for ged-emacs-devel@m.gmane.org; Fri, 24 Jan 2014 01:02:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6ZqY-0008Ey-S8 for emacs-devel@gnu.org; Fri, 24 Jan 2014 01:02:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6ZqR-0006V2-Up for emacs-devel@gnu.org; Fri, 24 Jan 2014 01:02:30 -0500 Original-Received: from forward7.mail.yandex.net ([77.88.61.37]:36333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6ZqR-0006Uw-Ke for emacs-devel@gnu.org; Fri, 24 Jan 2014 01:02:23 -0500 Original-Received: from smtp6.mail.yandex.net (smtp6.mail.yandex.net [77.88.61.56]) by forward7.mail.yandex.net (Yandex) with ESMTP id 26EC91C07A8 for ; Fri, 24 Jan 2014 10:02:22 +0400 (MSK) Original-Received: from smtp6.mail.yandex.net (localhost [127.0.0.1]) by smtp6.mail.yandex.net (Yandex) with ESMTP id 07B251640066 for ; Fri, 24 Jan 2014 10:02:21 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp6.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id GOlhhdk1QS-2LHq0EvD; Fri, 24 Jan 2014 10:02:21 +0400 (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (Client certificate not present) X-Yandex-Uniq: ba8567e0-6bb5-4670-ad5a-673b311bd7b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1390543341; bh=e4CErahqnwrOLt4Z9fopGbQOqlb33j+k75BHiAZXkjA=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Content-Transfer-Encoding; b=p122Lyh7vPGGUTaSHcgkFOUFMx5JddQZ5lDlBba6GiUM+cR0/Ks5+HjSu6zplvtAI 8xSY5x/+JBOpm8Jq4vAzQ7Y7PRco+qOW9gNLGncqP95LbFz0Rp/0R0dq6cQR1VGYC+ 1K6jgYf/1sugRtR+EskihOfb3TkXw2lv2WwmjMG8= Authentication-Results: smtp6.mail.yandex.net; dkim=pass header.i=@yandex.ru User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 77.88.61.37 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168994 Archived-At: 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