The following will max-out TeX's memory:
% arara: pdftex
\nonstopmode
\input expl3-generic \relax \ExplSyntaxOn
\int_zero:N \l_tmpa_int
\int_while_do:nn { \l_tmpa_int < 490000 }
{
\cs_new:cn { temp \int_use:N \l_tmpa_int : } { nothing }
\int_show:N \l_tmpa_int
\int_incr:N \l_tmpa_int
}
hi
\bye
giving the error
! TeX capacity exceeded, sorry [number of strings=494671].
after 489008 definitions. (I'm assuming the remaining ≈5k definitions are from the kernels and formats.)
I assume this number is available in a configuration file somewhere (for the 'wizards' who build TeX), but how can I get this number of strings=
dynamically from within TeX itself?
sh-3.2$ cat temp-file--8751S9O.tex
hi \bye
sh-3.2$ tex temp-file--8751S9O.tex >/dev/null
sh-3.2$ cat temp-file--8751S9O.log
This is TeX, Version 3.14159265 (TeX Live 2015) (preloaded format=tex 2015.5.24) 26 JUL 2015 09:34
**temp-file--8751S9O.tex
(./temp-file--8751S9O.tex [1] )
Output written on temp-file--8751S9O.dvi (1 page, 208 bytes).
sh-3.2$
\input
line, set "hello world", then\bye
, and check the stats in the log.\tracingstats=2
; the report occurs when the job ends. i suggested doing it once with an essentially empty file, so you'd have a baseline. (on the system i usually use, this is set as default, so i made a rash assumption.)texmf.cnf
file, but you can not get that information from TeX luatex is different, but uses dynamic allocation anyway so you don't run out until you run out of real memory.