From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#46326: 27.1.50; Excessive memory allocations with minibuffer-with-setup-hook Date: Fri, 05 Feb 2021 16:09:09 +0200 Message-ID: <83eehuppx6.fsf@gnu.org> References: <62c490ed0d8d24d8b259ac1ba55ea79e@mendler.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31778"; 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 Fri Feb 05 15:10:10 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 1l81oI-00089a-0B for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Feb 2021 15:10:10 +0100 Original-Received: from localhost ([::1]:44538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l81oH-0000h1-26 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Feb 2021 09:10:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l81oA-0000gO-4L for bug-gnu-emacs@gnu.org; Fri, 05 Feb 2021 09:10:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l81o9-0003xU-Pd for bug-gnu-emacs@gnu.org; Fri, 05 Feb 2021 09:10:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l81o9-0000dT-Ix for bug-gnu-emacs@gnu.org; Fri, 05 Feb 2021 09:10:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Feb 2021 14:10:01 +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.16125341532382 (code B ref 46326); Fri, 05 Feb 2021 14:10:01 +0000 Original-Received: (at 46326) by debbugs.gnu.org; 5 Feb 2021 14:09:13 +0000 Original-Received: from localhost ([127.0.0.1]:43228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l81nN-0000cL-H5 for submit@debbugs.gnu.org; Fri, 05 Feb 2021 09:09:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l81nM-0000c9-3p for 46326@debbugs.gnu.org; Fri, 05 Feb 2021 09:09:12 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45276) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l81nG-0003a2-8i; Fri, 05 Feb 2021 09:09:06 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4333 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l81nF-0000jl-Hc; Fri, 05 Feb 2021 09:09:06 -0500 In-Reply-To: <62c490ed0d8d24d8b259ac1ba55ea79e@mendler.net> (mail@daniel-mendler.de) 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:199382 Archived-At: > Date: Fri, 05 Feb 2021 13:51:41 +0100 > From: mail@daniel-mendler.de > > I have an issue on 27.1.50 with excessive memory allocations when using > minibuffer-with-setup-hook with large closures and :append. This issue > has been > observed in my Consult package, which is similar to Counsel and which > provides > commands based on completing-read. Naturally I have to perform some > setup in the > minibuffer-setup-hook. Most of the memory allocations are due to > add-hook and in > particular the sort function. The sort functions is called because of > :append > which sets a hook priority. The reason seems to be that large closures > are > copied, but I didn't fully investigate the reasons for the issue. > > Example profile: > > 140,068,687 92% - consult-buffer > 140,068,687 92% - consult--buffer Please show information about the memory consumption. (The so-called "memory profile" doesn't actually measure memory consumption at all, it just uses memory allocation calls as a poor-man's profiling signal.) Please show a recipe starting from "emacs -Q" where a lot of memory is being consumed, and please show how much memory does the recipe consume. Also, I presume invoking "M-x garbage-collect RET" doesn't release that memory? If so, please show the return value of garbage-collect. > See the issue https://github.com/minad/consult/issues/193 for reference. I don't see any memory information in that discussion. I guess you thought the memory profiler somehow shows memory consumption, but it doesn't. What exactly caused you to run the profiler? is the code slow or something? If so, the problem may be something other than memory consumption.