How to determine how much "save space" I am using

  • How do I determine how much save space was used form the log file?

At the end of the log file:

87i,19n,130p,10511b,4441s stack positions out of 5000i,500n,10000p,200000b,80000s

it is the fifth entry. Here, the used stack size is 4441, maximum stack size is 80000.


  • Am I correct in assuming that the cause of this is likely some change to a macro that is doing a large number of assignments in a group.

Possible causes:

  • A common mistake is the mix of local and global assignments inside a group to the same macro or register.

  • Often, the first ten registers are scratch registers, e.g. \dimen0, \dimen1, ..., \dimen9. The convention of plain TeX is that register with even numbers (0, 2, 4, 6, 8) are used for local assignments and odd numbered scratch registers (1, 3, 5, 7, 9) are used for global assignments only. Scratch register numbers 255 (\count@) is used for local assignment.


The save stack usage is shown in the line

 87i,19n,130p,10511b,4441s stack positions out of 5000i,500n,10000p,200000b,80000s

so 4441 in this case.

the TeXBook says

You can figure out what TeX puts on the save stack by setting \tracingrestores=1; then your log file will record information about whatever is removed from the stack at the end of a group.