From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#38345: 27.0.50; Permanent increase in memory consumption after opening images (or pdfs) Date: Mon, 02 Dec 2019 17:49:30 +0200 Message-ID: <83zhgaloc5.fsf@gnu.org> References: <87sgme1ww7.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> <83o8x0rl6d.fsf@gnu.org> <87lfs2mzo8.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> <87lfs19shb.fsf@mail.linkov.net> <87a78gn5k5.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> <83sgm8ox3g.fsf@gnu.org> <87zhgflxmc.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> <83lfrzq1s1.fsf@gnu.org> <87d0d7w3tt.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="132116"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38345@debbugs.gnu.org, juri@linkov.net To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 02 16:50:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ibnxm-000Y6j-OK for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Dec 2019 16:50:14 +0100 Original-Received: from localhost ([::1]:37700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibnxl-0006VW-He for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Dec 2019 10:50:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50102) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibnxf-0006Ui-1z for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 10:50:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibnxa-0004MG-3i for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 10:50:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32821) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibnxa-0004M8-01 for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 10:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ibnxZ-0008EF-RI for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 10:50: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: Mon, 02 Dec 2019 15:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38345 X-GNU-PR-Package: emacs Original-Received: via spool by 38345-submit@debbugs.gnu.org id=B38345.157530179031606 (code B ref 38345); Mon, 02 Dec 2019 15:50:01 +0000 Original-Received: (at 38345) by debbugs.gnu.org; 2 Dec 2019 15:49:50 +0000 Original-Received: from localhost ([127.0.0.1]:38794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibnxO-0008Di-E4 for submit@debbugs.gnu.org; Mon, 02 Dec 2019 10:49:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibnxN-0008DU-8B for 38345@debbugs.gnu.org; Mon, 02 Dec 2019 10:49:49 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:38476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ibnxH-0004Eh-4I; Mon, 02 Dec 2019 10:49:43 -0500 Original-Received: from [176.228.60.248] (port=2416 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ibnxG-0004Tg-Kp; Mon, 02 Dec 2019 10:49:42 -0500 In-reply-to: <87d0d7w3tt.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> (message from Ihor Radchenko on Mon, 02 Dec 2019 16:04:46 +0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172768 Archived-At: > From: Ihor Radchenko > Cc: juri@linkov.net, 38345@debbugs.gnu.org > Date: Mon, 02 Dec 2019 16:04:46 +0800 > > > The doc string assumes "normal" operation, it doesn't assume some Lisp > > command runs for a long time, thus preventing redisplay. > > Sounds counter-intuitive. Elisp commands can run for a long time > (pointing at org-agenda). Commands that run for a long time make Emacs unresponsive, and therefore are a misfeature or a bug. That said, a command that runs a long time is unlikely to create many images, destroying each one before creating the next one, because what would be the point of that? IOW, yours is a scenario that is infrequent at best, IMO. > I tried to look at the code, but I have to admit that I don't understand > the reason. Probably because of my poor C. Feel free to ask questions about the details you don't understand. > In any case, I tried different approach trying to reduce memory > fragmentation. Instead of using the default malloc/free, I used jemalloc > through LD_PRELOAD. For periodic cache clearing (every 2,10,50, and 100 > opened/killed images), there was no noticeable difference in the memory > consumption. However, when I tried to open a bunch of images all > together, killed them, and cleared the cache (as in my initial bug > report), the jemalloc instance of emacs showed much lower memory > consumption (~240Mb vs 1200Mb). I don't think replacing the system malloc on GNU/Linux systems (let alone on others) is an idea we'd like to pursue. You may have more luck playing with mallopt calls in init_alloc_once_for_pdumper (assuming your build defines DOUG_LEA_MALLOC).