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#43389: 28.0.50; Emacs memory leaks Date: Tue, 17 Nov 2020 22:36:58 +0200 Message-ID: <83eekrra8l.fsf@gnu.org> References: <87r1r5428d.fsf@web.de> <874kmcvlbj.fsf@mail.trevorbentley.com> <83imasb0te.fsf@gnu.org> <871rgzvbme.fsf@mail.trevorbentley.com> <83lff6zm8f.fsf@gnu.org> <87wnyju40z.fsf@mail.trevorbentley.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33389"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43389@debbugs.gnu.org To: Trevor Bentley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 17 21:38:12 2020 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 1kf7js-0008Xf-SM for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Nov 2020 21:38:08 +0100 Original-Received: from localhost ([::1]:39578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kf7jr-00006P-VE for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Nov 2020 15:38:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kf7jm-00006C-47 for bug-gnu-emacs@gnu.org; Tue, 17 Nov 2020 15:38:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kf7jl-0004EO-R4 for bug-gnu-emacs@gnu.org; Tue, 17 Nov 2020 15:38:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kf7jl-0007jq-OX for bug-gnu-emacs@gnu.org; Tue, 17 Nov 2020 15:38: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: Tue, 17 Nov 2020 20:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43389 X-GNU-PR-Package: emacs Original-Received: via spool by 43389-submit@debbugs.gnu.org id=B43389.160564543029671 (code B ref 43389); Tue, 17 Nov 2020 20:38:01 +0000 Original-Received: (at 43389) by debbugs.gnu.org; 17 Nov 2020 20:37:10 +0000 Original-Received: from localhost ([127.0.0.1]:33065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kf7iv-0007iU-Le for submit@debbugs.gnu.org; Tue, 17 Nov 2020 15:37:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kf7iu-0007iK-VC for 43389@debbugs.gnu.org; Tue, 17 Nov 2020 15:37:09 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34188) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kf7ip-0003u1-H3; Tue, 17 Nov 2020 15:37:03 -0500 Original-Received: from [176.228.60.248] (port=3829 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kf7io-0004Dw-6Y; Tue, 17 Nov 2020 15:37:02 -0500 In-Reply-To: <87wnyju40z.fsf@mail.trevorbentley.com> (message from Trevor Bentley on Tue, 17 Nov 2020 21:22:52 +0100) 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:193579 Archived-At: [Please use Reply All to keep the bug tracker on the CC list.] > From: Trevor Bentley > Cc: > Date: Tue, 17 Nov 2020 21:22:52 +0100 > > > . something called "gomp_thread_start" is called, and also > > allocates > > a lot of memory -- does this mean additional threads start > > running? > > > > Or am I reading the graphs incorrectly? > > You are right that they are present, but that path isn't > responsible for a significant percentage of the total memory usage > at the end. Doesn't look like gomp_thread_start is in the > bottom-most snapshot at all. It was reporting ~100MB allocated by > gomp_thread_start, out of 4GB. And those are related to images, > so 100MB is perhaps reasonable. AFAIK, glibc's malloc allocates a new heap arena for each thread that calls malloc. The arena is large, so having many threads could enlarge the footprint by a lot. That's hwy Florian suggested to set MALLOC_ARENA_MAX to a small value, to keep this path of footprint growth in check. > However, I'm now a bit suspicious of these log buffers. Last time > the usage spiked I had 15MB of reported buffers, and I was > watching the process RSS increase by 1MB every 5 seconds in top, > like a clockwork. I killed all of the large log buffers (3MB > each), and RSS stopped noticeably increasing. Not sure if that > _stopped_ the leak, or only slowed it down to beneath the > threshold top could show me. Either way, it should need 1.5GB of > RAM to track 15MB of text. Unless malloc somehow allocates buffer memory via sbrk and not mmap, buffers shouldn't be part of the footprint growth issue, because any mmap'ed memory can be munmap'ed without any restrictions, and returns to the OS. And you can see how many buffer memory you have by watching the statistics returned by garbage-collect. > gomp_thread_start appears to be triggered when images are > displayed. Yes, I believe ImageMagick starts them to scale images.