From: mail@daniel-mendler.de
To: Eli Zaretskii <eliz@gnu.org>
Cc: 46326@debbugs.gnu.org
Subject: bug#46326: 27.1.50; Excessive memory allocations with minibuffer-with-setup-hook
Date: Fri, 05 Feb 2021 17:10:46 +0100 [thread overview]
Message-ID: <631e918824625b8bde45b69664347398@mendler.net> (raw)
In-Reply-To: <83a6sipkv0.fsf@gnu.org>
Hello Eli!
> If you are saying that the Lisp code in question conses too many
> objects unnecessarily, then the solution is to modify the code to cons
> less objects. That doesn't necessarily indicates the existence of a
> bug in Emacs, certainly not with its memory management.
My code certainly *does not allocate* too much. It is the add-hook
implementation
or more precisely the minibuffer-with-setup-hook implementation which is
responsible for the excessive allocations. For this reason this is an
upstream
bug. In my workaround, I am replacing the upstream version of
minibuffer-with-setup-hook
with my own version to show the difference. This does not mean that I
consider
the problem to be gone. I rather decided to report the problem instead.
> So if you already have a solution for the problem, what is it that you
> want us as Emacs maintainers to investigate and fix here?
I am actually not sure what the proper upstream fix is. I see the
following
options.
1. Replace minibuffer-with-setup-hook with my version if you think
my version is better and an acceptable fix.
2. Investigate the reasons why add-hook with priorities somehow copies
large closures during sorting. This is unacceptably costly.
To give you a better picture of the overall situation - it looks like
this:
(minibuffer-with-setup-hook
(lambda () ...large closure...)
(minibuffer-with-setup-hook
(lambda () ...another large closure...)
(minibuffer-with-setup-hook
(:append (lambda () ...and yet another one...))
(completing-read ...))))
The bug is that the large closures are copied for some unknown reason in
the
add-hook calls which I am not controlling as a library author. My
replacement
adds the hooks in another way, by creating a symbol+fset instead of
putting the
lambda directly in the minibuffer-setup-hook variable.
Daniel
next prev parent reply other threads:[~2021-02-05 16:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 12:51 bug#46326: 27.1.50; Excessive memory allocations with minibuffer-with-setup-hook mail
2021-02-05 14:09 ` Eli Zaretskii
2021-02-05 15:20 ` mail
2021-02-05 15:58 ` Eli Zaretskii
2021-02-05 16:10 ` mail [this message]
2021-02-08 9:25 ` jakanakaevangeli
2021-02-09 0:19 ` mail
2021-02-09 22:13 ` jakanakaevangeli
2021-04-23 18:26 ` Stefan Monnier
2021-04-23 19:28 ` Daniel Mendler
2021-04-23 20:34 ` jakanakaevangeli
2021-04-23 20:52 ` Daniel Mendler
2021-04-23 21:27 ` Stefan Monnier
2021-04-24 6:10 ` Eli Zaretskii
2021-04-24 13:06 ` Stefan Monnier
2022-06-16 13:06 ` Lars Ingebrigtsen
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=631e918824625b8bde45b69664347398@mendler.net \
--to=mail@daniel-mendler.de \
--cc=46326@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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.