# [tex-live] xdvipdfmx says "** ERROR ** Capacity exceeded"

Fri Feb 19 11:37:20 CET 2010

On 19 Feb 2010, at 08:47, Daniel Rubin wrote:

>
> Somebody else suggested the issue might be related to nested boxes.  As
> I do have quite a lot of those, I'm hopeful that this might be the right
> track.  What do you think?

As I suggested to you on the xetex list, I'm pretty sure this is the root of the problem.

A trivial testcase would be something like

\global\setbox0=\hbox{x}
\newcount\n
\loop \ifnum\n < 250
\global\setbox0=\hbox{\box0}
\repeat
\shipout\box0
\end

which you can run with plain xetex. This works fine. But increase the loop limit to 260, and you'll get the DVI_STACK_DEPTH_MAX error.

Recompiling xdvipdfmx with a larger constant will defer the problem, but a nesting level of over 250 boxes is suggestive of a poorly-implemented page layout structure that could almost certainly be simplified/optimized.

(Note that if you do increase the driver stack to allow such complex pages, you could eventually hit a hard limit in the DVI format, and a problem in how TeX generates it. I think it's either 32K or 64K -- can't remember offhand if the relevant values are signed or unsigned 16-bit numbers. TeX itself doesn't detect the overflow, but the DVI output it creates will be incorrect.)

JK