<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi everybody!<br>
<br>
Assume that the files testa.pdf, testb.pdf and testc.pdf exist.<br>
<br>
Further assume there is a file mwe.tex:<br>
<blockquote><tt>\NeedsTeXFormat{LaTeX2e}</tt><br>
<tt>\documentclass[12pt]{letter}</tt><br>
<tt>\usepackage{shellesc,graphicx}</tt><br>
<tt>\begin{document}</tt><br>
<tt>\includegraphics{testa.pdf}\newpage</tt><br>
<tt>\includegraphics{testb.pdf}\newpage</tt><br>
<tt>\includegraphics{testc.pdf}\newpage</tt><br>
<tt>\immediate\write18{ lsof | grep latex | grep test | less -S }</tt><br>
<tt>\end{document}</tt><br>
</blockquote>
If (on a linux system) you execute<br>
<blockquote><tt>lualatex --shell-escape mwe</tt><br>
</blockquote>
<br>
and<br>
<blockquote><tt>xelatex --shell-escape mwe</tt><br>
</blockquote>
you see a difference: the included pdf files are open if you use<br>
lualatex, they are _not_open_ when xelatex is used.<br>
<br>
That difference is not a problem if you want to include only a few<br>
files, but it is a problem if you want to include a few thousands<br>
of pdfs - on most sytems there is a limit of about 1024 open files.<br>
<br>
That limit can be raised, but at least in my case that does<br>
not really help: using write18 to start a program when many file<br>
descriptors are open might expose a bug in the c++ library if "many"<br>
is "more than 1023". If that child uses execve() to start another
child,<br>
that execve fails with a "*** buffer overflow detected ***" message.<br>
<br>
Is this is a problem of luatex? I don't know, but I think it is. <br>
<br>
Keeping all files that are included by \includegraphics open is a<br>
wasteful use of limited system resources (file descriptors) , and
xetex<br>
demonstrates that it is not necessary.<br>
<br>
BTW: In my tests xelatex fails to include more than 5005 pdfs
correctly.<br>
Pdfs 5005+ are read, white space is reserved, but the actual
content of<br>
the included pdfs is missing. Nothing unusual is written to the log.<br>
<br>
System used:<br>
<ul>
<li>Linux, 64bit (i4790K, 32GB)<br>
</li>
<li>OpenSuSE Tumbleweed</li>
<li>LuaTeX, Version 1.0.4 (TeX Live 2017/TeX Live for SUSE Linux)</li>
<li>XeTeX 3.14159265-2.6-0.99998 (TeX Live 2017/TeX Live for SUSE
Linux)</li>
</ul>
<br>
Knut<br>
<br>
</body>
</html>