显示内存变量值

显示内存变量值

TeX 使用各种文件来设置各种项目的最大内存,例如“池大小”。是否有命令可以打印所有这些变量的值?

答案1

这是“依赖于发行版”的;基于 Web2C 的发行版(例如 TeX Live 或 MiKTeX)使用一个或多个texmf.cnf文件在运行时设置内存参数。对于这些发行版,命令行

kpsewhich -a texmf.cnf

将显示已加载文件的位置,您可以在其中查看设置。但是,只需在 TeX 文件中说

\tracingstats=1

(LaTeX 无论如何都会这么做)会导致 TeX 打印类似

Here is how much of TeX's memory you used:
 1 string out of 497974
 10 string characters out of 3220722
 5898 words of memory out of 3000000
 926 multiletter control sequences out of 15000+200000
 14794 words of font info for 50 fonts, out of 3000000 for 9000
 14 hyphenation exceptions out of 8191
 1i,0n,0p,17b,6s stack positions out of 5000i,500n,10000p,200000b,50000s

在文件末尾.log,内存参数非常容易辨认;pdfTeX 将添加其他信息,例如

PDF statistics:
 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

(是的,示例文件没有占用太多内存。)

XeTeX 的打印效果与 Knuth TeX 类似,而 LuaTeX 的打印效果略有不同:

Here is how much of LuaTeX's memory you used:
 3 strings out of 496569
 100000,35830 words of node,token memory allocated 161 words of node memory still in use:
   2 hlist, 1 rule, 1 glyph, 18 glue_spec nodes
   avail lists: 2:4,3:1,4:1,6:3
 2000 multiletter control sequences out of 65536+200000
 50 fonts using 1466661 bytes
 1i,0n,0p,16b,6s stack positions out of 5000i,500n,10000p,200000b,50000s
No pages of output.

PDF statistics: 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 131072)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

相关内容