all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Mike Coleman <tutufan@gmail.com>
Cc: 2790@emacsbugs.donarmstrong.com
Subject: bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit GNU/Linux box
Date: Fri, 27 Mar 2009 22:12:54 -0400	[thread overview]
Message-ID: <jwv63hueaoo.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <3c6c07c20903270927y5292e32as857233aa1fd75737@mail.gmail.com> (Mike Coleman's message of "Fri, 27 Mar 2009 11:27:23 -0500")

> Okay, tried it (emacs-23.0.91), but no luck.  Looks very nice, but
> finding that large file produced the same error.  The value of
> 'most-positive-fixnum' prints correctly, though (which is different).

There was an incorrect check that limited the size to INT_MAX/4
(i.e. 512MB for systems where ints are 32bit).  I've removed this check
in the CVS code (see patch below).  I am now able to open an 800MB file
with this check removed.  OTOH with a 2GB file, I got some unjustified
"memory exhausted" error, but I haven't tracked it down yet.  Note also
that when you open large files, it's worthwhile to use
find-file-literally to be sure it's opened in unibyte mode; otherwise
it gets decoded which takes ages.  Also if the file has many lines (my
800MB file was made up by copying a C file many times, so it had
millions of lines), turning off line-number-mode is is needed to recover
responsiveness when navigating near the end of the buffer.


        Stefan


Index: src/fileio.c
===================================================================
RCS file: /sources/emacs/emacs/src/fileio.c,v
retrieving revision 1.651
retrieving revision 1.652
diff -u -r1.651 -r1.652
--- src/fileio.c	24 Mar 2009 14:14:54 -0000	1.651
+++ src/fileio.c	28 Mar 2009 02:06:08 -0000	1.652
@@ -3300,7 +3300,11 @@
 	     overflow.  The calculations below double the file size
 	     twice, so check that it can be multiplied by 4 safely.  */
 	  if (XINT (end) != st.st_size
-	      || st.st_size > INT_MAX / 4)
+	      /* Actually, it should test either INT_MAX or LONG_MAX
+		 depending on which one is used for EMACS_INT.  But in
+		 any case, in practice, this test is redundant with the
+		 one above.
+		 || st.st_size > INT_MAX / 4 */)
 	    error ("Maximum buffer size exceeded");
 
 	  /* The file size returned from stat may be zero, but data






  parent reply	other threads:[~2009-03-28  2:12 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26 15:50 bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit Linux box Mike Coleman
2009-03-26 19:58 ` Eli Zaretskii
2009-03-26 21:01   ` Mike Coleman
2009-03-26 21:14     ` Eli Zaretskii
2009-03-26 21:33       ` Mike Coleman
2009-03-27  0:32         ` Stefan Monnier
2009-03-27  0:39           ` Mike Coleman
2009-03-27  3:08             ` bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit Linux Stefan Monnier
2009-03-27 16:29               ` Mike Coleman
2009-03-27  8:46         ` bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit Linux box Eli Zaretskii
2009-03-27 11:21       ` Andreas Schwab
2009-03-27  4:59 ` bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit GNU/Linux box Richard M Stallman
2009-03-27 16:27   ` Mike Coleman
2009-03-27 17:42     ` Eli Zaretskii
2009-03-28  2:12     ` Stefan Monnier [this message]
2009-03-28  5:24       ` Mike Coleman
2009-03-29 19:59         ` bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit Stefan Monnier
2009-03-28  8:45       ` bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit GNU/Linux box Eli Zaretskii
2009-03-28 11:12         ` Andreas Schwab
2009-03-28 12:03           ` Eli Zaretskii
2009-03-28 12:40             ` Andreas Schwab
2009-03-28 13:52               ` Eli Zaretskii
2009-03-29 20:13           ` Stefan Monnier
2009-03-29 20:10         ` Stefan Monnier
2009-03-29 20:44           ` Andreas Schwab
2009-03-30  0:59             ` Stefan Monnier
2009-03-30  8:08               ` Andreas Schwab
2009-03-30 13:01                 ` Stefan Monnier
2009-03-30 13:22                   ` Andreas Schwab
2009-03-29  2:15       ` Richard M Stallman
2009-03-29 20:14         ` Stefan Monnier
2009-03-28 15:17     ` Richard M Stallman
2009-03-28 16:27       ` Mike Coleman
     [not found]       ` <mailman.4163.1238258635.31690.bug-gnu-emacs@gnu.org>
2009-03-31 14:17         ` Ted Zlatanov
2011-09-11 22:10 ` bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit Linux box Lars Magne Ingebrigtsen
2011-09-12  2:59   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv63hueaoo.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=2790@emacsbugs.donarmstrong.com \
    --cc=tutufan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.