all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Greg Hendershott <mail@greghendershott.com>
To: Lars Ingebrigtsen <larsi@gnus.org>, Tom Gillespie <tgbugs@gmail.com>
Cc: "Mattias Engdegård" <mattiase@acm.org>, 56623@debbugs.gnu.org
Subject: bug#56623: memory leak introduced by new nonrecursive lisp reader
Date: Mon, 29 Aug 2022 08:59:21 -0400	[thread overview]
Message-ID: <87ilmbw6hi.fsf@greghendershott.com> (raw)
In-Reply-To: <CA+G3_PNjOqb5mGgo9sySijzmHKoYzwK52ERAfbmHVSe996bZzg@mail.gmail.com>

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	other threads:[~2022-08-29 12:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 22:03 bug#56623: memory leak introduced by new nonrecursive lisp reader Tom Gillespie
2022-07-18 11:21 ` Mattias Engdegård
2022-07-27  9:20   ` Mattias Engdegård
2022-08-27 15:35     ` Lars Ingebrigtsen
2022-08-28 17:29       ` Greg Hendershott
2022-08-28 21:06         ` Tom Gillespie
2022-08-29 12:59           ` Greg Hendershott [this message]
2022-08-29 15:20             ` Mattias Engdegård
2022-08-29 15:52               ` Mattias Engdegård
2022-08-29  8:44     ` Gerd Möllmann
2022-08-29  9:38       ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilmbw6hi.fsf@greghendershott.com \
    --to=mail@greghendershott.com \
    --cc=56623@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=mattiase@acm.org \
    --cc=tgbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.