bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#19266: 24.4; Font-related window redrawing delays on OS X


From: Eli Zaretskii
Subject: bug#19266: 24.4; Font-related window redrawing delays on OS X
Date: Sun, 07 Dec 2014 18:09:05 +0200

> Date: Sun, 7 Dec 2014 00:50:01 -0500
> From: Kirill Ignatiev <address@hidden>
> Cc: Eli Zaretskii <address@hidden>, address@hidden
> 
> 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.





reply via email to

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