From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#33275: 27.0.50; Image cache pruning Date: Mon, 05 Nov 2018 18:05:01 +0200 Message-ID: <83va5bcxxu.fsf@gnu.org> References: NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1541435390 8921 195.159.176.226 (5 Nov 2018 16:29:50 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Nov 2018 16:29:50 +0000 (UTC) Cc: 33275@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 05 17:29:46 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJhl2-0002AY-Sp for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Nov 2018 17:29:45 +0100 Original-Received: from localhost ([::1]:36115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJhn6-0001OJ-7o for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Nov 2018 11:31:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJhao-00051o-7O for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 11:19:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJhO8-0000zv-Ah for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 11:06:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59443) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gJhO6-0000vN-6x for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 11:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gJhO5-0004Qa-Rr for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 11:06: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, 05 Nov 2018 16:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33275 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33275-submit@debbugs.gnu.org id=B33275.154143394917000 (code B ref 33275); Mon, 05 Nov 2018 16:06:01 +0000 Original-Received: (at 33275) by debbugs.gnu.org; 5 Nov 2018 16:05:49 +0000 Original-Received: from localhost ([127.0.0.1]:35468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJhNp-0004Q4-Nn for submit@debbugs.gnu.org; Mon, 05 Nov 2018 11:05:49 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55629) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJhNk-0004Po-Nx for 33275@debbugs.gnu.org; Mon, 05 Nov 2018 11:05:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJhNG-0008Ob-ET for 33275@debbugs.gnu.org; Mon, 05 Nov 2018 11:05:22 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJhNC-0008Is-Kb; Mon, 05 Nov 2018 11:05:08 -0500 Original-Received: from [176.228.60.248] (port=1457 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gJhNA-00058R-TM; Mon, 05 Nov 2018 11:05:06 -0500 In-reply-to: (message from Lars Ingebrigtsen on Mon, 05 Nov 2018 15:07:30 +0100) 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: 208.118.235.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:152060 Archived-At: > From: Lars Ingebrigtsen > Date: Mon, 05 Nov 2018 15:07:30 +0100 > > So after trying various things, it turned out that you can kill Emacs by > doing this: > > (dolist (file (directory-files "/directory/with/many/images" t "png$")) > (image-size (create-image file) t)) > > and this is because `image-size' puts the image into the image cache. > Calling `clear-image-cache' releases the memory. > > I think putting it into the cache is the right thing to do, because if > you're calling `image-size' on a file, then nine out of ten times you > want to display it, and my use case here is atypical (batch-processing > of a large number of huge images), but it's still not optimal that you > can crash Emacs in this way. Doesn't this mean that your system's VM is misconfigured? How is it Emacs's fault that you've run a program that gobs so much memory as to trigger the OS's OOM killer? > So perhaps the cache should be pruned more aggressively according to > some smart algorithm or other? Or, at the very least, an > innocuous-looking function like `image-size' should note in the doc > string should note what's going on and recommend calling `image-flush' > afterwards if we don't want to cache the image? I'm okay with saying something about this in the docs, but frankly, you could do the same in any number of ways, like by visiting a file whose size is larger than the VM you allow your system to use, right? So there's a potential for causing such problems in many different ways, and warning about that only in the doc string of image-size seems insufficient, to say the least...