unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 8528@debbugs.gnu.org, ego111@gmail.com
Subject: bug#8528: 24.0.50; 32-bit Emacs with apparent 128M buffer size limit
Date: Thu, 21 Apr 2011 09:40:26 +0300	[thread overview]
Message-ID: <83mxjk2jl1.fsf@gnu.org> (raw)
In-Reply-To: <4DAFCC4F.1080900@cs.ucla.edu>

> Date: Wed, 20 Apr 2011 23:18:55 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: Evans Winner <ego111@gmail.com>, 8528@debbugs.gnu.org
> 
> On 04/20/11 22:52, Eli Zaretskii wrote:
> > Paul, could you please tell where do you see twice doubling of the
> > file size in insert-file-contents?
> 
> I assumed that it was because the internal buffers contain an
> Emacs-encoded version of the file, which could be as long as four
> times the actual file size, because a single byte in the file
> might expand to 4 bytes inside Emacs in some cases.

Actually, it could potentially expand even 5-fold (because Emacs
extends UTF-8 to codepoints as large as 0x3FFFFF).  But we test the
buffer size and avoid overflowing it in many other places, both
further down in insert-file-contents and in insdel.c.  If those are
not enough, we could add more such tests, particularly after decoding
the file's contents, where we know the full buffer size in bytes.

So I think artificially limiting the maximum size of a file that can
be visited in that particular place in insert-file-contents is too
harsh.

> That would explain the behavior that you saw: if your file's
> internal encoding was the same as the external, you wouldn't observe any
> problem.  The problem would be exhibited only with files containing
> many characters that bloat when read into memory.

Right, but wouldn't you agree that such a limitation is too stringent?
E.g., I should be able to use find-file-literally to visit a 512MB
file, but currently I cannot.





  reply	other threads:[~2011-04-21  6:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-20 21:04 bug#8528: 24.0.50; 32-bit Emacs with apparent 128M buffer size limit Evans Winner
2011-04-21  5:52 ` Eli Zaretskii
2011-04-21  6:18   ` Paul Eggert
2011-04-21  6:40     ` Eli Zaretskii [this message]
2011-04-21  6:58       ` Paul Eggert
2011-04-21 13:20         ` Eli Zaretskii
2011-04-29 19:49           ` Eli Zaretskii
2011-05-02 14:53             ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83mxjk2jl1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=8528@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=ego111@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).