10

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
                                                  51},{5831},{1047},{14948},
  • 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?

Update:

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].

Update:

I have done the following:

$ kpsewhich texmf.cnf
/usr/local/texlive/2011/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].
Village
  • 13,603
  • 23
  • 116
  • 219

2 Answers2

9

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).

egreg
  • 1,121,712
5

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.

qubyte
  • 17,299
  • The input stack size is currently 3,000,000. Assuming I made it only 1/8 of the way through, does that mean I should increase the memory to 24,000,000? If this number is set too high, is that likely to create some problems for my computer? I am using Debian. – Village Nov 19 '11 at 13:43
  • 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 Nov 19 '11 at 13:47
  • No, I downloaded and installed it using the TeX Live network installer. – Village Nov 19 '11 at 13:50
  • 1
    In that case the one to alter is /usr/local/texlive/2011/texmf.cnf. – qubyte Nov 19 '11 at 13:59
  • 1
    Any luck with this? – qubyte Nov 19 '11 at 14:52
  • No, it is no compiling more of the document, but I can't get it to compile more than 5/8 of the file. I've updated my original most with additional details. – Village Nov 20 '11 at 13:37
  • 1
    Add memory to all the fields and see what happens. Remember to run fmtutil-sys. – qubyte Nov 20 '11 at 13:39
  • And run it with all. – qubyte Nov 20 '11 at 13:53
  • I adjusted the file so all settings were set to 30000000 and ran fmtutil-sys --all. This brought no change. – Village Nov 20 '11 at 15:35
  • 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 Nov 20 '11 at 16:02
  • It is solved. I found this way: as the error says pool size=3186676, I added lines with large numbers for pool_size and pool_size.xlatex to the texmf.cnf file. Then , it reported not enough main memory, so I added main_memory and main_memory.xetex. Then , it reported not enough hash, so I added hash_extra and hash_extra.xetex. Finally, it compiles. – Village Nov 21 '11 at 00:42