unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 38345@debbugs.gnu.org
Subject: bug#38345: 27.0.50; Permanent increase in memory consumption after opening images (or pdfs)
Date: Sat, 23 Nov 2019 23:18:21 +0800	[thread overview]
Message-ID: <87k17q1v0i.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <83zhgmtznv.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

> I see no attachment here, but isn't this because Emacs never returns
> memory to the system when it frees it?

Sorry, I forgot to send the attachment in the first message. I have sent
a followup, but also attaching here just in case.

What you say about Emacs not returning memory sounds like very very
strange behaviour unless I misunderstand something. Does it mean that if
I have emacs running as daemon and open a few hundreds of heavy pdfs
during, say, a week, it will keep all the memory allocated for those pdfs
(which is several Gb, at least)? If so, I don't think that Emacs should
do it.

Regards,
Ihor


[-- Attachment #2: images2.png --]
[-- Type: image/png, Size: 21382 bytes --]

[-- Attachment #3: Type: text/plain, Size: 1872 bytes --]




Eli Zaretskii <eliz@gnu.org> writes:

>> From: Ihor Radchenko <yantar92@gmail.com>
>> Date: Sat, 23 Nov 2019 22:37:44 +0800
>> 
>> Recently, I have noticed that my emacs tends to increase its memory
>> usage up to over 1.5Gb after I open a large number of pdf documents. It
>> is understandable since some of the pdfs can be quite large. However,
>> the problem is that the memory does not seem to be released even after I
>> close all the pdf buffers.
>> 
>> First, I though that the issue is with pdf-tools and reported my problem
>> there (https://github.com/politza/pdf-tools/issues/177). However, the
>> memory consumption problem appears to happen even if I just open images.
>> 
>> I monitored emacs (emacs -Q) memory usage with 
>> https://github.com/dkogan/memory_leak_instrumentation
>> 
>> If I open a large (>250) photos using the code below, the memory usage
>> increases permanently even after I close all the image buffers and wait
>> for some time. 
>> 
>> #+begin_src emacs-lisp
>> (setq large-file-warning-threshold nil)
>> (setq image-cache-eviction-delay 5)
>> (find-file "~/Tosort/pictures&photos/*.jpg" 'wild)
>> (mapc #'kill-buffer (seq-filter (apply-partially #'string-match ".+.jpg$") (mapcar #'buffer-name (buffer-list))))
>> (clear-image-cache t)
>> (garbage-collect)
>> #+end_src
>> 
>> The attached is memory consumption plot I got after running M-x
>> eval-buffer on the code above several times (each run correspond to the
>> memory consumption peak on the plot).
>
> I see no attachment here, but isn't this because Emacs never returns
> memory to the system when it frees it?

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong University, Xi'an, China
Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg

  reply	other threads:[~2019-11-23 15:18 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-23 14:37 bug#38345: 27.0.50; Permanent increase in memory consumption after opening images (or pdfs) Ihor Radchenko
     [not found] ` <handler.38345.B.15745199896049.ack@debbugs.gnu.org>
2019-11-23 14:44   ` bug#38345: Acknowledgement (27.0.50; Permanent increase in memory consumption after opening images (or pdfs)) Ihor Radchenko
2019-11-23 14:48 ` bug#38345: 27.0.50; Permanent increase in memory consumption after opening images (or pdfs) Lars Ingebrigtsen
2019-11-23 15:12   ` Ihor Radchenko
2019-11-23 14:50 ` Eli Zaretskii
2019-11-23 15:18   ` Ihor Radchenko [this message]
2019-11-23 15:45     ` Eli Zaretskii
2019-11-23 16:04       ` Ihor Radchenko
2019-11-23 16:34         ` Eli Zaretskii
2019-11-23 17:33           ` Ihor Radchenko
2019-11-23 17:51             ` Eli Zaretskii
2019-11-25 16:10 ` Eli Zaretskii
2019-11-26 15:21   ` Ihor Radchenko
2019-11-26 15:55     ` Eli Zaretskii
2019-11-26 16:24       ` Ihor Radchenko
2019-11-27 21:17     ` Juri Linkov
2019-11-28  1:38       ` Ihor Radchenko
2019-11-28 12:35         ` Lars Ingebrigtsen
2019-11-28 13:11           ` Ihor Radchenko
2019-11-28 15:10         ` Eli Zaretskii
2019-11-28 17:27           ` Ihor Radchenko
2019-11-28 18:44             ` Eli Zaretskii
2019-12-02  8:04               ` Ihor Radchenko
2019-12-02 15:49                 ` Eli Zaretskii
2019-12-05  6:48                   ` Ihor Radchenko
2019-12-05 14:52                     ` Eli Zaretskii
2019-12-06  1:34                       ` Noam Postavsky
2019-12-06  7:52                         ` Eli Zaretskii
2019-12-07 19:25                           ` Noam Postavsky
2019-12-07 19:39                             ` Eli Zaretskii
2019-12-16  6:18                       ` Ihor Radchenko
2019-12-16 16:30                         ` Eli Zaretskii
2020-08-02 18:14                           ` Lars Ingebrigtsen
2020-08-02 22:52                             ` Ihor Radchenko
2020-08-03  6:10                               ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k17q1v0i.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me \
    --to=yantar92@gmail.com \
    --cc=38345@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).