My document contains many thousands of glossary items. When compiling with XeLaTeX, about 1/8 of the way through the document, it reports:

! TeX capacity exceeded, sorry [main memory size=3000000].
\@glolist@ ...},{13586},{9406},{4539},{12811},{179
  • The numbers you see above are ones placed in #1 of \newglossaryentry{#1}{#2}. These unique numbers are assigned to each entry for convenience.
  • I have successfully compiled short tests of the document, which only used 1% of the full content.
  • The resulting .glo file is about 1 MB in size.

Could this be the result of some error on my part or am I giving TeX too much work to do?


I have followed the instructions below (edited texmf.cnf and running fmtutil-sys --all. This has allowed me to compile an additional portion of the book, but no matter the settings I add, I can't go beyond 5/8 of the way through.

A compile with extra_mem_top.xelatex = 30000000 and extra_mem_top.xelatex = 50000000 both result in:

TeX capacity exceeded, sorry [pool size=3186676].


I have done the following:

$ kpsewhich texmf.cnf
$ nano /usr/local/texlive/2011/texmf.cnf

To the texmf.cnf file, following instructions at Increase TeX capacity, as non-root, I added:

main_memory = 230000000
extra_mem_top = 10000000
extra_mem_bot = 10000000
save_size = 150000
stack_size = 150000

main_memory.xelatex = 30000000
extra_mem_top.xelatex = 30000000

After this, I tried: - fmtutil-sys --all, then compiling xelatex file.tex. - fmtutil --all, then compiling xelatex file.tex. - fmtutil-sys --byfmt xelatex, then compiling with xelatex file.tex. - texhash, then compiling with xelatex file.tex.

All of these resulted in no changes in results. I still get:

TeX capacity exceeded, sorry [pool size=3186676].
  • It is quite possible that TeX runs out of memory with huge glossary files, as it has to create a few control sequences for each entry. You should mention what operating system and TeX distribution you're using, in order somebody is able to tell you how to enlarge TeX memory.
    – egreg
    Commented Nov 19, 2011 at 13:39
  • I am using Debian 6 with TeX Live 2011 installed from www.tug.org/texlive/.
    – Village
    Commented Nov 19, 2011 at 13:47
  • You can try enlarging also the main_memory as explained in my edited answer.
    – egreg
    Commented Nov 20, 2011 at 10:26
  • Have you defined all your glossary entries in the preamble or are there some defined in the document? If the latter, that could be a contributing factor, see Drawbacks With Defining Entries in the Document Environment. Commented Apr 5, 2014 at 23:10

2 Answers 2


Assuming nothing is wrong with your code, you need to increase the memory TeX is allowed. Take a look here for advice on how to do that.

What to do depends on the distribution you're using, and what OS you're on. This determines where the texmf.cnf file is, which you'll need to alter.

On TeXLive 2011, it is /usr/local/texlive/2011/texmf.cnf. Following alterations to this file, run

sudo fmtutil-sys --all

in a terminal.

  • 1
    It's not likely to cause you any issues at that number. There's a lot of advice in the file itself. Are you using TeXLive from the Debian package manager? I can add some detail above if I know.
    – qubyte
    Commented Nov 19, 2011 at 13:47
  • 1
    In that case the one to alter is /usr/local/texlive/2011/texmf.cnf.
    – qubyte
    Commented Nov 19, 2011 at 13:59
  • 1
    Any luck with this?
    – qubyte
    Commented Nov 19, 2011 at 14:52
  • 1
    Add memory to all the fields and see what happens. Remember to run fmtutil-sys.
    – qubyte
    Commented Nov 20, 2011 at 13:39
  • 1
    Hmm. This is a pickle! The next step is to show us the packages and macros you're using. Are you using lots of pgfplots? If that's the case, then externalise them (I can provide the keys to do that).
    – qubyte
    Commented Nov 20, 2011 at 16:02

You can try editing the secondary texmf.cnf file

sudo nano $(kpsewhich texmf.cnf)

(use your favorite text editor, for instance gedit, instead of nano). In the file that opens, append

extra_mem_top.xelatex = 20000000
main_memory.xelatex = 20000000

Save the file and run

sudo fmtutil-sys --byfmt xelatex

Then try compiling again. While modifying the first parameter doesn't generally require rebuilding formats, modifying the second does. It's the main memory that TeX (XeTeX) uses for the pool (names for control sequences).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .