From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jakanakaevangeli Newsgroups: gmane.emacs.bugs Subject: bug#46326: 27.1.50; Excessive memory allocations with minibuffer-with-setup-hook Date: Tue, 09 Feb 2021 23:13:03 +0100 Message-ID: <87czx899g0.fsf@miha-pc> References: <87v9b29aia.fsf@miha-pc> <558af936c04bf691e6eb953e2212bccd@mendler.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24469"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46326@debbugs.gnu.org To: mail@daniel-mendler.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 09 23:10:49 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9bDd-0006E6-3c for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 23:10:49 +0100 Original-Received: from localhost ([::1]:60564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9bDb-000107-Q4 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 17:10:48 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9bCs-0000zZ-QF for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 17:10:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9bCs-0001dH-JC for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 17:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l9bCs-0002hL-Df for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 17:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: jakanakaevangeli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Feb 2021 22:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46326 X-GNU-PR-Package: emacs Original-Received: via spool by 46326-submit@debbugs.gnu.org id=B46326.161290855210302 (code B ref 46326); Tue, 09 Feb 2021 22:10:02 +0000 Original-Received: (at 46326) by debbugs.gnu.org; 9 Feb 2021 22:09:12 +0000 Original-Received: from localhost ([127.0.0.1]:54943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9bC4-0002g6-LG for submit@debbugs.gnu.org; Tue, 09 Feb 2021 17:09:12 -0500 Original-Received: from chiru.no ([142.4.209.132]:34882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9bC3-0002fy-3H for 46326@debbugs.gnu.org; Tue, 09 Feb 2021 17:09:11 -0500 Original-Received: from localhost (BSN-77-156-43.static.siol.net [193.77.156.43]) by chiru.no (Postfix) with ESMTPSA id 15BFC128001B; Tue, 9 Feb 2021 22:09:09 +0000 (UTC) In-Reply-To: <558af936c04bf691e6eb953e2212bccd@mendler.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199741 Archived-At: (minibuffer-with-setup-hook (lambda ()) (let ((print-circle t)) (message "%S" (car minibuffer-setup-hook)))) Evaluating this in with lexical-binding enabled, we can see that the anonymous closure added to the hook indeed contains circular structures. Since remove-hook uses delete rather than delq, it would probably be a good idea to have minibuffer-with-setup-hook add a symbol rather than closure to the hook, just like in set-transient-map. I believe that set-transient-map was adjusted to use a symbol (in commit bf1e6ae81df3a2a8f2ba4027c9e96a0097acddc5) for a very similar reason.