From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.devel
Subject: Re: warn-maybe-out-of-memory
Date: Fri, 11 Jul 2014 13:00:50 +0300
Message-ID: <831ttsb4fh.fsf@gnu.org>
References: <83egxtax97.fsf@gnu.org> <83d2ddaw52.fsf@gnu.org>
	<53BF6B2F.5030701@yandex.ru> <837g3kbd9g.fsf@gnu.org>
	<53BFA3BB.6090709@yandex.ru> <8361j4b744.fsf@gnu.org>
	<53BFB1C3.9020202@yandex.ru>
Reply-To: Eli Zaretskii <eliz@gnu.org>
NNTP-Posting-Host: plane.gmane.org
X-Trace: ger.gmane.org 1405072920 25951 80.91.229.3 (11 Jul 2014 10:02:00 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 11 Jul 2014 10:02:00 +0000 (UTC)
Cc: emacs-devel@gnu.org
To: Dmitry Antipov <dmantipov@yandex.ru>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 11 12:01:53 2014
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1X5XeK-00044g-5D
	for ged-emacs-devel@m.gmane.org; Fri, 11 Jul 2014 12:01:52 +0200
Original-Received: from localhost ([::1]:43567 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1X5XeJ-0006a0-Pj
	for ged-emacs-devel@m.gmane.org; Fri, 11 Jul 2014 06:01:51 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59163)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eliz@gnu.org>) id 1X5XdX-0006WN-Ru
	for emacs-devel@gnu.org; Fri, 11 Jul 2014 06:01:49 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eliz@gnu.org>) id 1X5XdI-0007PC-S4
	for emacs-devel@gnu.org; Fri, 11 Jul 2014 06:01:03 -0400
Original-Received: from mtaout21.012.net.il ([80.179.55.169]:50365)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@gnu.org>)
	id 1X5XdI-0007MH-Ho
	for emacs-devel@gnu.org; Fri, 11 Jul 2014 06:00:48 -0400
Original-Received: from conversion-daemon.a-mtaout21.012.net.il by
	a-mtaout21.012.net.il (HyperSendmail v2007.08) id
	<0N8J00800KSCLG00@a-mtaout21.012.net.il> for
	emacs-devel@gnu.org; Fri, 11 Jul 2014 13:00:46 +0300 (IDT)
Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0N8J008HJL5ALI10@a-mtaout21.012.net.il>;
	Fri, 11 Jul 2014 13:00:46 +0300 (IDT)
In-reply-to: <53BFB1C3.9020202@yandex.ru>
X-012-Sender: halo1@inter.net.il
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 80.179.55.169
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=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:172972
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/172972>

> Date: Fri, 11 Jul 2014 13:43:31 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: emacs-devel@gnu.org
> 
> On 07/11/2014 01:02 PM, Eli Zaretskii wrote:
> 
> > I mean the cases where the file size is borderline, near the available
> > memory, but slightly less than that.
> 
> We may warn if file size reaches or exceeds, say, 90% of available memory.

That's a good start.  But decoding non-ASCII text could expand the
size by a factor of 2 in many cases, so perhaps 50% is a better
threshold, at least in non-English locales?

> > Then how does this feature make sense?  It is, according to you,
> > unpredictable and uncontrollable.
> 
> This depends on OS and VM pressure. For example, on GNU/Linux if I have
> just slightly above 8G free:
> 
> $ free
>               total       used       free     shared    buffers     cached
> Mem:      16127204    7762072    8365132      68248      84396    6401276
> -/+ buffers/cache:    1276400   14850804
> 
> and asks for 10G, the kernel may shrink page cache by 2G and satisfy
> 10G mmap request, thus fooling the logic I'm using to issue the warning.

On Windows, the swap file is enlarged in this situation.

> But under some circumstances, this may be not so; in short, I think that
> we need to support more OSes and gather more feedback from users.

Agreed.

Btw, this feature is all but useless for 32-bit builds on any modern
machine, since the buffer size limitation almost always hits much
sooner.