tikz.dev / PGFplots Manual

Manual for Package pgfplots
2D/3D Plots in LA, Version 1.18.1
http://sourceforge.net/projects/pgfplots

Memory and Speed considerations

\(\newcommand{\footnotename}{footnote}\) \(\def \LWRfootnote {1}\) \(\newcommand {\footnote }[2][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\newcommand {\footnotemark }[1][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\let \LWRorighspace \hspace \) \(\renewcommand {\hspace }{\ifstar \LWRorighspace \LWRorighspace }\) \(\newcommand {\mathnormal }[1]{{#1}}\) \(\newcommand \ensuremath [1]{#1}\) \(\newcommand {\LWRframebox }[2][]{\fbox {#2}} \newcommand {\framebox }[1][]{\LWRframebox } \) \(\newcommand {\setlength }[2]{}\) \(\newcommand {\addtolength }[2]{}\) \(\newcommand {\setcounter }[2]{}\) \(\newcommand {\addtocounter }[2]{}\) \(\newcommand {\arabic }[1]{}\) \(\newcommand {\number }[1]{}\) \(\newcommand {\noalign }[1]{\text {#1}\notag \\}\) \(\newcommand {\cline }[1]{}\) \(\newcommand {\directlua }[1]{\text {(directlua)}}\) \(\newcommand {\luatexdirectlua }[1]{\text {(directlua)}}\) \(\newcommand {\protect }{}\) \(\def \LWRabsorbnumber #1 {}\) \(\def \LWRabsorbquotenumber "#1 {}\) \(\newcommand {\LWRabsorboption }[1][]{}\) \(\newcommand {\LWRabsorbtwooptions }[1][]{\LWRabsorboption }\) \(\def \mathchar {\ifnextchar "\LWRabsorbquotenumber \LWRabsorbnumber }\) \(\def \mathcode #1={\mathchar }\) \(\let \delcode \mathcode \) \(\let \delimiter \mathchar \) \(\def \oe {\unicode {x0153}}\) \(\def \OE {\unicode {x0152}}\) \(\def \ae {\unicode {x00E6}}\) \(\def \AE {\unicode {x00C6}}\) \(\def \aa {\unicode {x00E5}}\) \(\def \AA {\unicode {x00C5}}\) \(\def \o {\unicode {x00F8}}\) \(\def \O {\unicode {x00D8}}\) \(\def \l {\unicode {x0142}}\) \(\def \L {\unicode {x0141}}\) \(\def \ss {\unicode {x00DF}}\) \(\def \SS {\unicode {x1E9E}}\) \(\def \dag {\unicode {x2020}}\) \(\def \ddag {\unicode {x2021}}\) \(\def \P {\unicode {x00B6}}\) \(\def \copyright {\unicode {x00A9}}\) \(\def \pounds {\unicode {x00A3}}\) \(\let \LWRref \ref \) \(\renewcommand {\ref }{\ifstar \LWRref \LWRref }\) \( \newcommand {\multicolumn }[3]{#3}\) \(\require {textcomp}\) \( \newcommand {\meta }[1]{\langle \textit {#1}\rangle } \) \(\newcommand {\toprule }[1][]{\hline }\) \(\let \midrule \toprule \) \(\let \bottomrule \toprule \) \(\def \LWRbooktabscmidruleparen (#1)#2{}\) \(\newcommand {\LWRbooktabscmidrulenoparen }[1]{}\) \(\newcommand {\cmidrule }[1][]{\ifnextchar (\LWRbooktabscmidruleparen \LWRbooktabscmidrulenoparen }\) \(\newcommand {\morecmidrules }{}\) \(\newcommand {\specialrule }[3]{\hline }\) \(\newcommand {\addlinespace }[1][]{}\) \(\require {colortbl}\) \(\let \LWRorigcolumncolor \columncolor \) \(\renewcommand {\columncolor }[2][named]{\LWRorigcolumncolor [#1]{#2}\LWRabsorbtwooptions }\) \(\let \LWRorigrowcolor \rowcolor \) \(\renewcommand {\rowcolor }[2][named]{\LWRorigrowcolor [#1]{#2}\LWRabsorbtwooptions }\) \(\let \LWRorigcellcolor \cellcolor \) \(\renewcommand {\cellcolor }[2][named]{\LWRorigcellcolor [#1]{#2}\LWRabsorbtwooptions }\) \(\newcommand {\intertext }[1]{\text {#1}\notag \\}\) \(\let \Hat \hat \) \(\let \Check \check \) \(\let \Tilde \tilde \) \(\let \Acute \acute \) \(\let \Grave \grave \) \(\let \Dot \dot \) \(\let \Ddot \ddot \) \(\let \Breve \breve \) \(\let \Bar \bar \) \(\let \Vec \vec \) \(\newcommand {\nicefrac }[3][]{\mathinner {{}^{#2}\!/\!_{#3}}}\)

7.2Memory Limitations

The default settings of most distributions are quite restrictive, so it may be necessary to adjust them.

Usually, the logfile or the final error message contains a summary about the used resources, giving a hint which parameter needs to be increased.

7.2.1Lua

One solution which works quite well is to switch the executable: if you have a decent distribution, you will have the lualatex executable as well. This, in turn, uses dynamic memory allocation such that it usually has enough memory for any pgfplots axis.

The Lua executable lualatex is supposed to be almost compatible with pdflatex.

This approach works for any platform.

7.2.2MiK

If you are running MiK and you do not want to (or cannot switch) to lualatex, you can proceed as follows.

For MiK, memory limits can be increased in two ways. The first is to use command line switches:

pdflatex --stack-size=n --save-size=n --main-memory=n --extra-mem-top=n --extra-mem-bot=n --pool-size=n --max-strings=n

Experiment with these settings if MiK runs out of memory. Usually, one doesn’t invoke pdflatex manually: there is a development aid which does all the invocations, so this one needs to be adjusted.

Sometimes it might be better to adjust the MiK configuration file permanently, for example to avoid reconfiguring the development program. This can be implemented using the command

initexmf --edit-config-file=pdflatex

which can be typed either on a command prompt in Windows or using Start \(\gg \) Execute. As a result, an editor will be opened with the correct config file. A sample config file could be

main_memory=90000000 save_size=80000

or any of the config file entries which are listed below can be entered. Thanks to “LeSpocky” for his documentation in

http://blog.antiblau.de/2009/04/21/speicherlimits-von-miktex-erhoehen.

7.2.3Live or similar installations

In addition to the option to switch to lualatex, you can proceed as follows to keep existing dvips or pdflatex workflows.

For Unix installations, one needs to adjust config files. This can be done as follows:

  • 1. Locate texmf.cnf on your system. On my Ubuntu installation, it is in

    /usr/share/texmf/web2c/texmf.cnf.

  • 2. Either change texmf.cnf directly, or copy it to some convenient place. If you copy it, here is how to proceed:

    • keep only the changed entries in your local copy to reduce conflicts. will always read all config files found in its search path.

    • Adjust the search path to find your local copy. This can be done using the environment variable TEXMFCNF. Assuming your local copy is in ~/texmf/mytexcnf/texmf.cnf, you can write

      export TEXMFCNF=~/texmf/mytexcnf:

      to search first in your directory, then in all other system directories.

  • 3. You should change the entries

    main_memory = n extra_mem_top = n extra_mem_bot = n max_strings = n param_size = n save_size = n stack_size = n

    The logfile usually contains information about the parameter which needs to be enlarged.

An example of this config file thing is shown below. It changes memory limits.

  • 1. Create the file ~/texmf/mytexcnf/texmf.cnf (and possibly the paths as well).

    % newly created file ~/texmf/mytexcnf/texmf.cnf: % If you want to change some of these sizes only for a certain TeX % variant, the usual dot notation works, e.g., % main_memory.hugetex = 20000000 main_memory = 230000000 % words of inimemory available; also applies to inimf&mp extra_mem_top = 10000000 % extra high memory for chars, tokens, etc. extra_mem_bot = 10000000 % extra low memory for boxes, glue, breakpoints, etc. save_size = 150000 % for saving values outside current group stack_size = 150000 % simultaneous input sources % Max number of characters in all strings, including all error messages, % help texts, font names, control sequences. These values apply to TeX and MP. % pool_size = 1250000 % Minimum pool space after TeX/MP's own strings; must be at least % 25000 less than pool_size, but doesn't need to be nearly that large. % string_vacancies = 90000 % Maximum number of strings. % max_strings = 100000 % min pool space left after loading .fmt % pool_free = 47500
  • 2. Run texhash such that updates its ~/texmf/ls-R database.

  • 3. Create the environment variable TEXMFCNF and assign the value ‘~/texmf/mytexcnf:’ (including the trailing ‘:’!). For my linux system, this can be done using by adding

    export TEXMFCNF=~/texmf/mytexcnf:

    to ~/.bashrc.

Unfortunately, does not allow arbitrary memory limits, there is an upper bound hard coded in the executables.