|
From: | |
Subject: | bug#46326: 27.1.50; Excessive memory allocations with minibuffer-with-setup-hook |
Date: | Tue, 09 Feb 2021 01:19:05 +0100 |
User-agent: | Roundcube Webmail/1.2-git |
On 2021-02-08 10:25, jakanakaevangeli wrote:
I seem to have solved the problem by doing the following simple substitutions in add-hook and remove-hook: (alist-get ... #'equal) -> (alist-get ...) equal -> eq member -> memq delete -> delq This changes the behaviour of add/remove-hook a little, for example (add-hook (lambda () (test))) (remove-hook (lambda () (test))) will not be reverse operations anymore, since the two lambdas are not eq as they are created separately. But the performance gain for big non-compiled closures might be worth considering.
Thank you, this also seems like a possible solution. However I fear that it is way to intrusive and could break a lot of existing code. As I mentioned before set-transient-map avoids adding a letrec-lambda via add-hook because it would make problems with equal. This means the "broken nature" of add-hook is somehow accepted pervasively over the Emacs codebase. My fix is less intrusive in the sense that it would just fix `minibuffer-with-setup-hook'.
[Prev in Thread] | Current Thread | [Next in Thread] |