emacs-devel
[Top][All Lists]
Advanced

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

Re: Collecting markers with MPS


From: Helmut Eller
Subject: Re: Collecting markers with MPS
Date: Wed, 24 Apr 2024 17:03:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Wed, Apr 24 2024, Eli Zaretskii wrote:

>> And I was hoping you would say: "We don't need to collect markers.  It's
>> a nicety that was easy to do in the old GC.  If it's not easy in the new
>> GC, leave it out".
>
> Can we really do that?  I don't think so, but maybe I'm missing
> something.

We don't need it for correctness.  We would unlikely run out of memory.
However, a buffer with an unreasonably long marker-chain will make some
operations slower.  How much slowness can we accept?  I don't know;
maybe I should measure this first.

We could also provide functions to manually unlink markers from the
buffer that programmers could use to keep the slowness in check.

>> How would the main thread know that a marker is not referenced from
>> anywhere else than from the undo-list?  Are you saying the main thread
>> should still do some marking as the old GC did, so that it can make the
>> decisions on the same mark bits?
>
> Can't the new GC tell us which markers are unreferenced?

The MPS supports finalization and weak references.  Finalization could
tell us which markers are unreferenced.  The problem is that markers
stay referenced as long as they are part of the buffer's marker-chain or
the undo-list.

That's why we could use weak references here.  If a marker is referenced
only through weak references then MPS can collect it.  MPS will also set
the weak reference to 0 when the marker has been collected.  So that we
know when we no longer can/need to update the marker.

The old GC knows which references are weak; that's what the special code
there is for.  For MPS, we somehow need to tell it which references are
weak.

Helmut



reply via email to

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