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: Thu, 10 Jul 2014 21:47:37 +0300
Message-ID: <83d2ddaw52.fsf@gnu.org>
References: <83egxtax97.fsf@gnu.org>
Reply-To: Eli Zaretskii <eliz@gnu.org>
NNTP-Posting-Host: plane.gmane.org
X-Trace: ger.gmane.org 1405018079 5590 80.91.229.3 (10 Jul 2014 18:47:59 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 10 Jul 2014 18:47:59 +0000 (UTC)
Cc: emacs-devel@gnu.org
To: dmantipov@yandex.ru
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 10 20:47:52 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 1X5JNo-0004hq-M4
	for ged-emacs-devel@m.gmane.org; Thu, 10 Jul 2014 20:47:52 +0200
Original-Received: from localhost ([::1]:39612 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 1X5JNo-0008By-6d
	for ged-emacs-devel@m.gmane.org; Thu, 10 Jul 2014 14:47:52 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37276)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eliz@gnu.org>) id 1X5JNe-0008BV-P0
	for emacs-devel@gnu.org; Thu, 10 Jul 2014 14:47:48 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eliz@gnu.org>) id 1X5JNY-0007LT-PP
	for emacs-devel@gnu.org; Thu, 10 Jul 2014 14:47:42 -0400
Original-Received: from mtaout28.012.net.il ([80.179.55.184]:52087)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@gnu.org>)
	id 1X5JNY-0007LP-HI
	for emacs-devel@gnu.org; Thu, 10 Jul 2014 14:47:36 -0400
Original-Received: from conversion-daemon.mtaout28.012.net.il by mtaout28.012.net.il
	(HyperSendmail v2007.08) id
	<0N8I00B00ETKQO00@mtaout28.012.net.il> for emacs-devel@gnu.org;
	Thu, 10 Jul 2014 21:47:08 +0300 (IDT)
Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout28.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0N8I003H1EUKYH70@mtaout28.012.net.il>;
	Thu, 10 Jul 2014 21:47:08 +0300 (IDT)
In-reply-to: <83egxtax97.fsf@gnu.org>
X-012-Sender: halo1@inter.net.il
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 80.179.55.184
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:172941
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/172941>

> Date: Thu, 10 Jul 2014 21:23:32 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> I wonder if this function should only warn when it is called from
> commands invoked by the user, as opposed to from a Lisp program.  The
> warning is in find-file-noselect, which AFAIK is widely used in Lisp
> programs, where displaying this warning might be inappropriate.
> 
> In addition, the function assumes that visiting a file of size N bytes
> needs N bytes of memory, which is false: we need more, sometimes much
> more.

Also, is this call to emacs_abort really appropriate?  Or is it some
remnant from debugging this code?

  DEFUN ("memory-info", Fmemory_info, Smemory_info, 0, 0, 0,
	 doc: /* Return a list of (TOTAL-RAM FREE-RAM TOTAL-SWAP FREE-SWAP).
  All values are in Kbytes.  If there is no swap space, last two
  values are zero.  If the system is not supported, return nil.  */)
    (void)
  {
  #ifdef HAVE_LINUX_SYSINFO
    struct sysinfo si;
    uintmax_t units;

    if (sysinfo (&si))
      emacs_abort ();  <<<<<<<<<<<<<<<<<<<<<<