From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19266: 24.4; Font-related window redrawing delays on OS X Date: Sun, 07 Dec 2014 18:09:05 +0200 Message-ID: <83fvcrzbku.fsf@gnu.org> References: <83y4qn50ua.fsf@gnu.org> <957C7241-1F90-42A3-83DE-4696B483C1F0@lunaryorn.com> <83ppbz4t3f.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1417968627 23654 80.91.229.3 (7 Dec 2014 16:10:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Dec 2014 16:10:27 +0000 (UTC) Cc: swiesner@lunaryorn.com, 19266@debbugs.gnu.org To: Kirill Ignatiev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 07 17:10:19 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1XxePb-0005uJ-2V for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Dec 2014 17:10:19 +0100 Original-Received: from localhost ([::1]:58335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxePa-0003Vo-AW for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Dec 2014 11:10:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxePQ-0003UQ-R3 for bug-gnu-emacs@gnu.org; Sun, 07 Dec 2014 11:10:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxePK-000829-HB for bug-gnu-emacs@gnu.org; Sun, 07 Dec 2014 11:10:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxePK-00081x-ET for bug-gnu-emacs@gnu.org; Sun, 07 Dec 2014 11:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XxePK-0001Qw-4q for bug-gnu-emacs@gnu.org; Sun, 07 Dec 2014 11:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Dec 2014 16:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19266 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19266-submit@debbugs.gnu.org id=B19266.14179685635456 (code B ref 19266); Sun, 07 Dec 2014 16:10:02 +0000 Original-Received: (at 19266) by debbugs.gnu.org; 7 Dec 2014 16:09:23 +0000 Original-Received: from localhost ([127.0.0.1]:56405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxeOg-0001Pv-H7 for submit@debbugs.gnu.org; Sun, 07 Dec 2014 11:09:23 -0500 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:49259) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxeOd-0001Pk-NK for 19266@debbugs.gnu.org; Sun, 07 Dec 2014 11:09:20 -0500 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NG700500Z68NA00@a-mtaout21.012.net.il> for 19266@debbugs.gnu.org; Sun, 07 Dec 2014 18:09:17 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NG7005BOZJH8TB0@a-mtaout21.012.net.il>; Sun, 07 Dec 2014 18:09:17 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96940 Archived-At: > Date: Sun, 7 Dec 2014 00:50:01 -0500 > From: Kirill Ignatiev > Cc: Eli Zaretskii , 19266@debbugs.gnu.org > > I find that many faces that were previously used get garbage collected > (I see macfont_close being called from cleanup_vector), but I don't > know how faces are stored, nor do I understand why they are no longer > referenced (common sense suggests that they should remain in memory as > long as the buffer that used them is still there). Face realizations are not specific to buffers, they are specific to frames. So the same face can be realized differently on each frame, and the same buffer displayed on 2 different frames might look differently. OTOH, a given face can be used by many buffers on a frame. So we cannot easily make a simple one-to-one connection between buffers and faces they use. > It seems that the faces are not actively used for displaying the > buffer, but can be expected to be reused in a short time (e.g., > region face or comment face). You forgot the 'default' face, by far the most reused face. Also, Emacs consults the face every time it needs to display a character which uses that face. So caching is really a necessity. > Can someone explain where faces are stored and why they are no longer > referenced, even though the buffer that used them is still active? Realized faces are stored in the frame's face_cache. As for the second part of your question, I hope I clarified the issue at least to some extent. > I am not sure if this is related to this bug, but there is a constant > CLEAR_FACE_CACHE_COUNT (=500) that causes face cache to be cleared > every 500 redisplays. Does anyone understand why this is really > necessary? Because we don't really know when a face is no longer needed. Tracking that could be more hassle than throwing the cache away from time to time. Anyway, if you enlarge that number 100-fold, does the problem go away? If not, then this is not the cause of your problem. Also, font objects are stored and maintained differently than faces. So I'm not sure you are on the right track looking into faces. Thanks.