From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r107264: shr.el (shr-rescale-image): Allow viewing large images. Date: Tue, 14 Feb 2012 00:20:31 -0800 Organization: UCLA Computer Science Department Message-ID: <4F3A194F.8000508@cs.ucla.edu> References: <874nuuwlib.fsf@gnus.org> <4F3972C3.2010209@cs.ucla.edu> <8762fawk1t.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1329207655 29510 80.91.229.3 (14 Feb 2012 08:20:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2012 08:20:55 +0000 (UTC) Cc: Katsumi Yamaoka , Stefan Monnier , emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 14 09:20:53 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RxDd6-0003gl-LO for ged-emacs-devel@m.gmane.org; Tue, 14 Feb 2012 09:20:52 +0100 Original-Received: from localhost ([::1]:38882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxDd5-0007iR-QP for ged-emacs-devel@m.gmane.org; Tue, 14 Feb 2012 03:20:51 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:57858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxDcz-0007i4-3W for emacs-devel@gnu.org; Tue, 14 Feb 2012 03:20:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxDcu-0007v1-Ru for emacs-devel@gnu.org; Tue, 14 Feb 2012 03:20:45 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:43517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxDcu-0007sl-KH for emacs-devel@gnu.org; Tue, 14 Feb 2012 03:20:40 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 491C739E800E; Tue, 14 Feb 2012 00:20:31 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BXu3KpDl57ed; Tue, 14 Feb 2012 00:20:30 -0800 (PST) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 97BBF39E800A; Tue, 14 Feb 2012 00:20:30 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111229 Thunderbird/9.0 In-Reply-To: <8762fawk1t.fsf@gnus.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:148602 Archived-At: On 02/13/2012 12:33 PM, Lars Ingebrigtsen wrote: > the default value of 6.0 disallows a lot of real-world > images. (9gag in particular.) Perhaps binding it to, say, 60.0 in > shr.el would make sense? We have to do something. The recently-changed trunk behavior, where there's no limit at all, is asking for trouble. It really needs to get fixed before Emacs 24 comes out. By '9gag' do you mean 9gag.com? Currently, its third image is 472x4464, which I suppose could run into a problem with max-image-size being 6.0 if your screen is small. But 60.0 would be way too large. A typical frame size for me is 500x1100, and allowing 30,000x66,000 images would make my 5-year-old desktop (with 2 GiB of RAM) keel over and die. I suggest the following heuristic instead. Take the total amount of physical memory, divide by 64, and reject images that would consume more than that amount of RAM. For example, my desktop has 2 GiB of physical RAM, so any image requiring more than 32 MiB of RAM would be rejected; this would easily allow the 9gag image mentioned above, which consumes about 9 MiB assuming 32 bits per pixel. The divisor "64" is a heuristic that could be user-adjusted; but the point is that dividing RAM by 64 is a more-useful default than multiplying the frame size by 6. If all this is too much trouble, I suggest going back to the 6.0 limit for now, and revisiting this issue after Emacs 24.1 comes out.