I have a tex file that's generated by an automated bioinformatics pipeline as a report. Usually, this is roughly 50-150 pages, but that's based on 1-3 samples. It contains many quality control graphs. I now have a run with 60 samples, which explodes the size to 4026 pages. The problem is that pdflatex keeps failing when I include pictures. There are 8843 pictures in the file, in 4874 figure blocks and they are all called within a minipage and subfloat, e.g. something like:

        \subfloat[Raw read 1]{
        \subfloat[Preprocessed read 1]{
    \caption{Read length distribution for read 1.}

I keep getting these two errors:

!pdfTeX error: /usr/bin/pdflatex (file /data/DIV4/ihb-diabetes/projects/slik-tc
uality.png): buffer overflow at file ../../../texk/web2c/pdftexdir/utils.c, lin
e 183
 ==> Fatal error occurred, no output PDF file produced!


S46_L002_R2_001.qc_fastqc/Images/per_sequence_gc_content.png, id=55775, 803.0pt
 x 602.25pt>
! TeX capacity exceeded, sorry [pool size=6181497].
\Ginclude@png ...pty \else , page \GPT@page \fi >}
                                              \GPT@info {#1\ifx \GPT@pag...
l.144122             }

!  ==> Fatal error occurred, no output PDF file produced!

This happens even when I try to increase pool_size and extra_mem_bot. My final pdflatex call was:

'/usr/bin/pdflatex' -8bit --extra-mem-bot=11150000000 --pool-size=196181497  '-output-directory' '/data/DIV4/ihb-diabetes/projects/slik-tcell/analysis/01_gentrap_new/report'  '-jobname' 'gentrap_report'  '/data/DIV4/ihb-diabetes/projects/slik-tcell/analysis/01_gentrap_new/gentrap_report.tex'

The only way I managed to get a PDF file was by running pdflatex with another user which doesn't have permissions to read the folders where the pictures are located. Naturally, that resulted in a whole load of permission denied errors, but it got me something. That leads me to believe the errors are figure related. Would there be a way which reduces the memory load of my figures? (Whether a 4026 page report with nearly 9000 figures is a readable document is another question altogether).

  • 1
    What may help is to externalize your graphs (a feature of pgf). This turns the figures into pdf files which are smaller in size but look exactly the same as if they were generated in a single run.
    – JPi
    Apr 7, 2015 at 13:16
  • IIRC there is an upper limit to the memory pdfTeX can use without changing the source (something like 256M). You could try lualatex. Apr 7, 2015 at 13:43
  • @MartinSchröder yes but pool size seems an odd limit to hit Apr 7, 2015 at 13:46
  • 2
    what happens if you use more reasonable length filenames such as sequence_length_distribution instead of /data/DIV4/ihb-diabetes/projects/slik-tcell/analysis/01_gentrap_new/sample_H7-59-17-AN/lib_S61-L003/flexiprep/H7-59-17-AN_S61_L003_R1_001.qc.fastqc/H7-59-17-AN_S61_L003_R1_001.qc_fastqc/Images/sequence_length_distribution.png (You shouldn't need the full path, just make sure the images are in your TEXINPUTS path) Apr 7, 2015 at 13:55
  • @JPi how would I do that?
    – Gx1sptDTDa
    Apr 7, 2015 at 14:01

1 Answer 1


It is the the length of the paths you are using.

/tmp/../tmp/../tmp/../tmp/../tmp/../tmp/../tmp/../tmp/\z house.png}\par
%\includegraphics{/c/tmp/\z house.png}\par


Produces the error that you show, in my case

! TeX capacity exceeded, sorry [pool size=6135010].

the ../tmp/...... construct just accesses the file /c/tmp/house.png but with a suitably long path and the \z redefinition ensures that a distinct path is used every time.

Every distinct path uses up the string pool.

If you comment out the \includegraphics with the long path and use instead the one with a shorter path then the document succeeds with pool usage shown as

 5790653 string characters out of 6135010

In your case you could use


which would drastically reduce the string pool usage, you just need to ensure that the directory with the images is in the TEXINPUT path.

For example if they were in the current directory, or just set


before running latex.

  • Does TEXINPUTS work with relative paths? E.g., the common denominator of all images files is only /data/DIV4/ihb-diabetes/projects/slik-tcell/
    – Gx1sptDTDa
    Apr 8, 2015 at 8:38
  • @Gx1sptDTDa end the path segment with // and it will search all subdirectories from there. with that many files it would be worth having ! at the front and using texhash to index the directory for kpathsearch like the main tex tree, but that just speeds it up, get it working first:-) Apr 8, 2015 at 8:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .