I am using LuaLaTeX to compile a file that will have estimated 4,000 pages. Quite obviously, though for Lua engine itself there are no complications in the file, my system runs out of memory on Page 944. How am I able to create such a file?
I hope for a method that would allow me to compile the file in separate seances and fuse the results. Just splitting will mess with the page numbering. I want to avoid actually creating multiple volumes in separate files.
The problem apparently is in the complicated font setup, with luatex-ja used to work with a CJK font parallel to the original one, and the font itself redefined with an intricate fallback similar to this:
\setmainjfont{SourceHanSans}[
Extension = .ttc,
UprightFeatures = {
FontIndex=19,
AltFont = {
{ Range="2C9CA,
Font="fallbackfont.otf"
},
{ Range="2C710,
Font="fallbackfont.otf"
},
... (20 more definitions)
Log files
When compiling, the process just stops:
...[941] [942]
[943] [944]
! TeX capacity exceeded, sorry [node memory size=1821640]
! Sorry, I ran out of memory.
Cutting down on fonts changes nothing, but removing all the fallback substitutions at all immediately lets the file to compile.