From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#33275: 27.0.50; Image cache pruning Date: Mon, 05 Nov 2018 15:07:30 +0100 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1541426830 17997 195.159.176.226 (5 Nov 2018 14:07:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Nov 2018 14:07:10 +0000 (UTC) To: 33275@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 05 15:07:06 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 1gJfWz-0004Zy-Hd for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Nov 2018 15:07:05 +0100 Original-Received: from localhost ([::1]:35482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJfZ6-0003P9-1G for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Nov 2018 09:09:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJfYw-0003N0-9G for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 09:09:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJfYt-0003GU-0x for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 09:09:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gJfYs-0003G8-SF for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 09:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gJfYs-0001SP-J9 for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 09:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Nov 2018 14:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33275 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15414268855530 (code B ref -1); Mon, 05 Nov 2018 14:09:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Nov 2018 14:08:05 +0000 Original-Received: from localhost ([127.0.0.1]:34702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJfXx-0001R7-1R for submit@debbugs.gnu.org; Mon, 05 Nov 2018 09:08:05 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48689) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJfXv-0001Qe-JI for submit@debbugs.gnu.org; Mon, 05 Nov 2018 09:08:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJfXp-0002BQ-7V for submit@debbugs.gnu.org; Mon, 05 Nov 2018 09:07:58 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43099) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJfXp-0002BD-2U for submit@debbugs.gnu.org; Mon, 05 Nov 2018 09:07:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJfXo-0002Nk-2Z for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 09:07:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJfXk-00025e-Nf for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 09:07:56 -0500 Original-Received: from lamora.getmail.no ([84.210.184.7]:50622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJfXk-0001lD-G9 for bug-gnu-emacs@gnu.org; Mon, 05 Nov 2018 09:07:52 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by lamora.getmail.no (Postfix) with ESMTP id F1D6860840 for ; Mon, 5 Nov 2018 15:07:30 +0100 (CET) Original-Received: from lamora.getmail.no ([127.0.0.1]) by localhost (lamora.get.c.bitbit.net [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id r3Ad1Lq2lR-M for ; Mon, 5 Nov 2018 15:07:30 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by lamora.getmail.no (Postfix) with ESMTP id 781E960842 for ; Mon, 5 Nov 2018 15:07:30 +0100 (CET) X-Virus-Scanned: amavisd-new at lamora.get.c.bitbit.net Original-Received: from lamora.getmail.no ([127.0.0.1]) by localhost (lamora.get.c.bitbit.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id z3IaSEm1gCTC for ; Mon, 5 Nov 2018 15:07:30 +0100 (CET) Original-Received: from stories (cm-84.212.221.165.getinternet.no [84.212.221.165]) by lamora.getmail.no (Postfix) with ESMTPSA id 4C5C960840 for ; Mon, 5 Nov 2018 15:07:30 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:152052 Archived-At: I was writing a function to do some image processing, and after it had run a few minutes, the Emacs window disappeared. After poking around a bit, it turned out that Emacs was killed by the out-of-memory task. I though that Emacs must have a serious memory leak somewhere, but `garbage-collect' didn't really seem to have anything mysterious in it. 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. 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? In GNU Emacs 27.0.50 (build 50, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2018-08-26 built on stories Repository revision: 5c642b2dc1b666ae488225b76251750a8cf331be Windowing system distributor 'The X.Org Foundation', version 11.0.11902000 System Description: Debian GNU/Linux 9 (stretch) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no