Go to the first, previous, next, last section, table of contents.

Does Emacs have problems with files larger than 8 megabytes?

Most installed versions of GNU Emacs will use 24-bit signed integers (and 24-bit pointers) internally. This limits the file size that Emacs can handle to 8,388,607 bytes (2^23 - 1).

Leonard N. Zubkoff <lnz@lucid.com> suggests putting the following two lines in src/config.h before compiling Emacs to allow for 26-bit integers and pointers (and thus filesizes of up to 33,554,431 bytes):

  #define VALBITS 26
  #define GCTYPEBITS 5

WARNING: This method may result in `ILLEGAL DATATYPE' and other random errors on some machines.

David Gillespie <daveg@csvax.cs.caltech.edu> gives an explanation of why Emacs uses 24 bit integers and pointers:

  Emacs is largely written in a dialect of Lisp; Lisp is a freely-typed
  language in the sense that you can put any value of any type into any
  variable, or return it from a function, and so on.  So each value must
  carry a "tag" along with it identifying what kind of thing it is, eg.,
  integer, pointer to a list, pointer to an editing buffer, and so on.
  Emacs uses standard 32-bit integers for data objects, taking the top 8
  bits for the tag and the bottom 24 bits for the value.  So integers (and
  pointers) are somewhat restricted compared to true C integers and
  pointers.
  Emacs uses 8-bit tags because that's a little faster on byte-oriented
  machines, but there are only really enough tags to require 6 bits.

Go to the first, previous, next, last section, table of contents.