all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: Tom Gillespie <tgbugs@gmail.com>,
	56623@debbugs.gnu.org, greghendershott@gmail.com
Subject: bug#56623: memory leak introduced by new nonrecursive lisp reader
Date: Sat, 27 Aug 2022 17:35:37 +0200	[thread overview]
Message-ID: <8735dh7l86.fsf@gnus.org> (raw)
In-Reply-To: <7DC3EB6A-097E-46F1-806E-33C02F01EA47@acm.org> ("Mattias Engdegård"'s message of "Wed, 27 Jul 2022 11:20:11 +0200")

Mattias Engdegård <mattiase@acm.org> writes:

> A counter-argument is that these undead objects will only be kept artificially alive as long as GC only takes place in the reader. Anyway, the hunch is easily tested: try either or both of these changes:
>
> 1. reduce stackbufsize:
>
> --- a/src/lread.c
> +++ b/src/lread.c
> @@ -2919,7 +2919,7 @@ digit_to_number (int character, int base)
>  /* Size of the fixed-size buffer used during reading.
>     It should be at least big enough for `invalid_radix_integer' but
>     can usefully be much bigger than that.  */
> -enum { stackbufsize = 1024 };
> +enum { stackbufsize = 64 };
>
>  static void
>  invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS (stackbufsize)],
>
> 2. zero the buffer on entry:
>
> --- a/src/lread.c
> +++ b/src/lread.c
> @@ -3678,6 +3678,7 @@ read_stack_push (struct read_stack_entry e)
>  read0 (Lisp_Object readcharfun, bool locate_syms)
>  {
>    char stackbuf[stackbufsize];
> +  memset (stackbuf, 0, stackbufsize);
>    char *read_buffer = stackbuf;
>    ptrdiff_t read_buffer_size = sizeof stackbuf;
>    char *heapbuf = NULL;
>
> If either makes things better, maybe we can come up with a solution that doesn't hurt performance.

This was a month ago -- Tom, did you try these changes?





  reply	other threads:[~2022-08-27 15:35 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 [this message]
2022-08-28 17:29       ` Greg Hendershott
2022-08-28 21:06         ` Tom Gillespie
2022-08-29 12:59           ` Greg Hendershott
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=8735dh7l86.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=56623@debbugs.gnu.org \
    --cc=greghendershott@gmail.com \
    --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.