I had the same requirement when I worked with pgfplots - and I found a way.
The resulting steps have made their way into the pgfplots manual, compare the pdf at http://pgfplots.sourceforge.net/
For your convenience, I post a copy of the section about TeX-Live here, it will probably answer your question:
6.2.2 TEXLive or similar installations
For Unix installations, one needs to adjust config files. This can be done as follows:
Locate texmf.cnf on your system. On my Ubuntu installation, it is in
texmf.cnf directly, or copy it to some convenient place. If you copy it, here is how to
keep only the changed entries in your local copy to reduce conflicts. TEX 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
to search first in your directory, then in all other system directories.
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.
- 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
Run texhash such that TEX updates its
Create the environment variable
TEXMFCNF and assign the value
~/texmf/mytexcnf: (including the
: !). For my linux system, this can be done using by adding
Unfortunately, TEX does not allow arbitrary memory limits, there is an upper bound hard coded in the