Skip to content

Marker leak and undo history size explosion #257

@CyberShadow

Description

@CyberShadow

Steps to reproduce:

  1. Run:

    emacs -Q \
      -l ~/.emacs.d/straight/repos/rich-minority/rich-minority.el \
      -l ~/.emacs.d/straight/repos/smart-mode-line/smart-mode-line.el \
      --eval '(setq custom-safe-themes t)' --eval '(sml/setup)'

    (adjust paths accordingly)

  2. Type something (about 20-50 characters), then undo it.

  3. Repeat step above 2-3 times.

  4. Evaluate (press M-:, paste, then RET):

    (let ((n 0))
     (mapc (lambda (el)
         (when (and (consp el) (markerp (car el)))
           (setq n (1+ n))))
       buffer-undo-list)
     n))

Normally (without SML loaded), this produces a small number. However, with SML loaded, the number is very large - in the hundreds / thousands.

SML or something it uses is creating markers in the buffer, which end up being referenced in the undo history. The undo history length grows exponentially.

I suspect that this is [partially] responsible for the number of times one can undo being very small in practice.

Possibly related Emacs bug:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=52798

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions