emacs-devel
[Top][All Lists]
Advanced

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

Re: MPS: dangling markers


From: Ihor Radchenko
Subject: Re: MPS: dangling markers
Date: Fri, 28 Jun 2024 16:37:41 +0000

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

>> AFAIK, markers are the only one that can be reachable (i.e. we may
>> spend time looking at them) yet GC-able, because the buffers' `markers`
>> slot contains a linked-list of all markers that's treated specially by
>> the GC (basically, the list is "weak" so markers get removed from this
>> list during GC if the marker is reachable only from the list).
>
> Exactly.

I looked closer into the version of buf_charpos_to_bytepos in
scratch/igc, and I notice that

# define DO_MARKERS(b, m)                                                  \
  for (struct marker_it it_ = marker_it_init (b); marker_it_valid (&it_); \
       marker_it_next (&it_)) \
    for (struct Lisp_Marker *m = marker_it_marker (&it_); m; m = NULL)

is a double loop, which is different from version of master (master has
a single for loop).

Inside the loop body, we have

      /* If we are down to a range of 50 chars,
         don't bother checking any other markers;
         scan the intervening chars directly now.  */
      if (best_above - charpos < distance
          || charpos - best_below < distance)
        break;

which will break out only from the inner loop, continuing traversal over
the full marker list.

(I cannot test it for the time being because the latest scratch/igc does
not compile for me)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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