Re: etex and pdftex have diverging memory constraints?

jfbu via tex-live <[email protected]>
Newsgroups gmane.comp.tex.live
Message-ID <[email protected]>

> Le 27 août 2025 à 15:59, Jim Diamond <[email protected]> a écrit :
> 
> On Wed, Aug 27, 2025 at 15:15 (+0200), jfbu via tex-live wrote:
> 
>> Hi,
> 
>> Sorry if this is very basic, but I always thought the sole difference between etex and pdftex is that the former works to produce a dvi and the latter a pdf.
> 
>> So, I was surprised to discover (or perhaps I observed that years ago and forgot) that pdftex has slightly more constrained memory constraints on macro expansion.
> 
>> Here is a test file testxintLength.tex
> 
>> ----
>> \input xintkernel.sty
>> \edef\x{\romannumeral\xintreplicate{%     
>> 2492679%
>> }{F}}
>> \expandafter\xintLength\expandafter{\x}
>> \bye
>> ----
> 
>> (the code creates a macro \x expanding to 2492679 F's then attempts to measure how many F's there are).
> 
>> Compilation with etex succeeds  (even with 2492694 in place of 2492679).
> 
>> $ etex testxintLength.tex
>> This is pdfTeX, Version 3.141592653-2.6-1.40.28 (TeX Live 2025) (preloaded format=etex)
>> restricted \write18 enabled.
>> entering extended mode
>> (./testxintLength.tex (./xintkernel.sty) [1] )
>> Output written on testxintLength.dvi (1 page, 216 bytes).
>> Transcript written on testxintLength.log.
> 
>> But compilation with pdftex fails.
> 
>> $ pdftex testxintLength
>> This is pdfTeX, Version 3.141592653-2.6-1.40.28 (TeX Live 2025) (preloaded format=pdftex)
>> restricted \write18 enabled.
>> entering extended mode
>> (./testxintLength.tex (./xintkernel.sty)
>> ! TeX capacity exceeded, sorry [main memory size=5000000].
>> <inserted text> 2492679
>>                        \xintlength ...xint_c_i \xint_c_ \xint_bye \relax                                                     l.5 \expandafter\xintLength\expandafter{\x}
>>                                            !  ==> Fatal error occurred, no output PDF file produced!
>> Transcript written on testxintLength.log.
> 
>> I am a bit surprised because I can not connect the constraints on TeX macro expansion with the output format DVI or PDF.  Needless to say I am completely ignorant of the innards.
> 
> Pdftex works fine on this example (Slackware64 15.0), at least in the sense
> that pdftex runs to completion.  The output PDF doesn't show the F's, at
> least with the viewer I tried.
> 
> Perhaps if you mention what OS you are using some additional help might be
> forthcoming.


Hello I am on macOS (as Herbert who also says the file compiles on his system).

The output PDF will contain simply the number 2492679 and the page number.

On my machine I have confirmed via modifying main_memory  in texmf.cnf and recompiling the etex and pdftex formats that the limits (a bit lower for pdftex) are about half the value of main_memory parameter.

I am intrigued by yours and Herbert report that compilation succeeds. I was working with the dev version of xint, but the used macros have had no modification but to be sure I checked out the 1.4m from 2022 which is last release and as expected I got same result.

It is unavoidable that a crash occurs with etex/pdftex if the 2492679 is replaced by some large enough number, so if you have time to waste on this you can try to set it to a higher value.

I am surprised the upper limit at my locale is lower than what you and Herbert experiment... and Herbert confirmed being with TL default memory settings like myself.

Kind regards


Jean-François
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.