Eli Zaretskii writes: >> From: Ihor Radchenko >> 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