From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#45200: [PATCH] Force Glibc to free the memory freed Date: Tue, 02 Feb 2021 23:50:41 -0500 Message-ID: References: <83k0rz21dw.fsf@gnu.org> <331805c74fc5d3d412dd2065030b11fa3343710d.camel@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9509"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: carlos@redhat.com, fweimer@redhat.com, 45200@debbugs.gnu.org, dj@redhat.com To: Konstantin Kharlamov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 03 05:51:22 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 1l7A8P-0002OH-KL for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Feb 2021 05:51:21 +0100 Original-Received: from localhost ([::1]:60602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7A8O-00076t-Mn for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Feb 2021 23:51:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7A87-00073r-Na for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2021 23:51:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53225) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7A86-0004iX-7x for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2021 23:51:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l7A86-0006CY-6W for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2021 23:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Feb 2021 04:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45200 X-GNU-PR-Package: emacs Original-Received: via spool by 45200-submit@debbugs.gnu.org id=B45200.161232785523825 (code B ref 45200); Wed, 03 Feb 2021 04:51:02 +0000 Original-Received: (at 45200) by debbugs.gnu.org; 3 Feb 2021 04:50:55 +0000 Original-Received: from localhost ([127.0.0.1]:36538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7A7z-0006CD-Li for submit@debbugs.gnu.org; Tue, 02 Feb 2021 23:50:55 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:8956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7A7x-0006By-Mw for 45200@debbugs.gnu.org; Tue, 02 Feb 2021 23:50:54 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 518E180C19; Tue, 2 Feb 2021 23:50:48 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C444B807A5; Tue, 2 Feb 2021 23:50:42 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1612327842; bh=OZHixiDZqfoUdoJcxjfq9OdDtiwqDQX6Ls3kWZVsMI0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=WwIO2+ScaUQtTWS0qca67/ECOYui6097je5AfQDUZDsch7JAp4QNItqpsME451pOm X1JLa6hSksPodYG1XDdPYrdIgk0SQ1MxkU1UnAiwk9LdO0YQquQLf9WBeMyE4YBffC BuqW1hqIkSgxbVNF93u3rbNK2mGF68efRSW1cq/++8A4gygeQBegfkZHbJcLxYOcpZ iv/t96mGum37JErZL9Xo0zHpeog9DHUHCFE+Mz3nac4oMrmMKaAUJj+02nESQubdjQ UANrBExIIJgPTUBhX8zb+uktRk55N+PAU3BqNjTWcFAUz5L/Nd7tf8LSekyITYahNB DjBCyQWfh8s2w== Original-Received: from alfajor (76-10-182-85.dsl.teksavvy.com [76.10.182.85]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6CCC312005C; Tue, 2 Feb 2021 23:50:42 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Tue, 02 Feb 2021 23:45:17 -0500") 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:199175 Archived-At: >> with malloc_trim: >> (8.920371394 232 2.106283245) >> (9.038083601 231 2.060810826) >> (9.140798641 231 2.0594013240000004) >> >> without malloc_trim: >> (8.987097209 232 2.070143482) >> (8.700478084 231 1.7745506179999997) >> (8.781121056 231 1.7870093610000004) >> >> The difference is just 3-4% (8.7 / 9 =E2=89=88 0.9666666667). It looks t= o me >> insignificant enough to not show up anywhere during interactive work >> with Emacs. > > It's indeed not too costly, but what about the upside? BTW, maybe a better way forward than trying to convince us that it's a good default (which could be hard if the upside is a reduction of the memory use by a few percent: for many people it might be less relevant/noticeable than the corresponding few percents lost in speed) is to provide a patch that adds a new *ELisp* function that calls `malloc_trim`, which you can then add to `post-gc-hook` in your init file when your usage pattern makes it useful. Stefan