emacs-devel
[Top][All Lists]
Advanced

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

Re: scratch/igc: Implications of MPS being asynchronous


From: Gerd Möllmann
Subject: Re: scratch/igc: Implications of MPS being asynchronous
Date: Sat, 25 Jan 2025 11:09:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Pip Cet <pipcet@protonmail.com> writes:

>> I skipped weak structures for learning MPS, so I just left this out. For
>> MPS, some other weak structure would be needed, If one wants that. Maybe
>> a weak hash table could be used for the font cache?
>
> While weak hash tables may continue to be necessary (I'm not sure about
> this), for internal data structures we control, finalizers are
> better:
>
> When you allocate a font structure, allocate an extra cons cell which
> you always use to refer, via XCAR, to the font structure.  Except that
> in the hash table, you use the car directly.  When the cons cell is no
> longer reachable (the font structure still is, because it's in the hash
> table), the finalizer will eventually run, and then you can remove the
> hash table entry from the hash table, eventually freeing the font
> structure, too..
>
> Note that this works with MPS finalizers (slow) and struct
> Lisp_Finalizer finalizers (even slower).  We should prefer the former as
> Lisp finalizers don't behave precisely like MPS finalizers; right now,
> we just use MPS behavior for Lisp finalizers, but that doesn't match the
> documentation in every detail.

Something like that, yes. Or maybe just clear the font caches completely
when some criterion is met? Time, size, something else, no idea.




reply via email to

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