Q: We have a workload which needs to have around 5000 PDF documents
in memory *at the same time*.
After approximately 2100 PDFDoc objects have been instantiated PDFNet
throws an exception [1], stating that no more temp files could be
opened.
The temp folder (%TEMP%) indeed contains ~2100 files named Trn[1-4 hex
digits].tmp.
Now if we disable PDFNet Caching
(pdftron.PDF.PDFNet.SetDefaultDiskCachingEnabled(false)) then it works
fine. But we can’t do that in some cases with limited RAM.
So could you please fix the temp file generator to not error out after
~2100 files?
[1]
pdftron.Common.PDFNetException: Exception:
Message: An error occurred during page import: Could
not open a temporary file. Make sure to close unused documents.
------------------------------
A: The maximum number of PDF files that can be simultaneously opened
in a single process is 2048.
This a hard upper limit for the number of simultaneously open files
accessed through the C run-time library (CRT). For more info, please
see:
http://msdn.microsoft.com/en-us/library/6e3b887c(v=vs.80).aspx
Besides SetDefaultDiskCachingEnabled() you could limit the number of
simultaneously opened files to ~2K (e.g. have a cache of documents -
it is very unlikely that all of them need to be used at the same
time), or have multiple simultaneous processes.