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

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

bug#56623: memory leak introduced by new nonrecursive lisp reader


From: Greg Hendershott
Subject: bug#56623: memory leak introduced by new nonrecursive lisp reader
Date: Mon, 29 Aug 2022 08:59:21 -0400
User-agent: mu4e 0.9.18; emacs 25.2.2

I think I've discovered the problem.

The new `read' leaks when it errors.

Here's a little driver to elicit this:

--------------------------------------------------
 
;; Run this with e.g. emacs --batch -Q -l example.el
(message "Run htop and observe the RES value")
(dotimes (n 512)
  (message "%s" n)
  (with-temp-buffer
    ;; Insert an unclosed sexp
    (insert "(")
    ;; Make it large, with quite a few sub-expressions to read
    (dotimes (_ 8192)
      (insert (format "%S" '(foo bar baz "a somewhat long string blah blah blah 
blah blah\n"))))
    ;; Go to start and attempt a read. This will fail due to the
    ;; unclosed paren, so we use `ignore-errors'.
    (goto-char (point-min))
    (ignore-errors (read (current-buffer)))))

;; With the old recursive lread.c, the RES value will oscillate around
;; a stable low value (presumably as GC happens).

;; With the new non-recursive lread.c, the RES value will climb
;; unbounded into hundreds of megabytes.

--------------------------------------------------

I hope this helps!





reply via email to

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