# Increasing the size of the memory: not all files are built successfully

I am trying to compile a large file which contains a tikz picture with more data points than tex can handle.

Following the questions here and here I set to increase the capacity of tex by changing the file texmf.cnf in my path /usr/local/texlive/2012. I included the line

main_memory = 10000000

and on terminal I run

sudo fmtutil-sys --all

The problem is that this memory is not enough, and numbers bigger than that don't finish the fmtutil run properly. I get the error

fmtutil: Error! Not all formats have been built successfully.

To give a better idea of where the problem is coming from, if I only include in the file texmf.cnf the lines

main_memory.latex = 15000000
main_memory.pdflatex = 15000000

then these are the files which are not properly built:

This is a summary of all `failed' messages:
`pdftex -ini  -jobname=latex -progname=latex -translate-file=cp227.tcx *latex.ini' failed
`pdftex -ini  -jobname=pdflatex -progname=pdflatex -translate-file=cp227.tcx *pdflatex.ini' failed

How can I increase the size of the memory beyond 10000000? Am I doing anything wrong?

(BTW, I am running texlive 2012 on a mac)

-
Maybe externalizing the large TikZ drawing first might help for the rest? –  percusse Jul 26 '12 at 10:29
Can you try issuing the command shown on the last line and report the error message? You may try increasing extra_mem_top and extra_mem_bot, which doesn't require rebuilding formats. –  egreg Jul 26 '12 at 10:31
@percusse Not sure what you mean by that... If you are saying I should try and compile the tikz file separately, then it wouldn't help because the tikz picture is all I am trying to compile (that's all that my .tex file has). If that's not what you mean, could you explain a bit more? –  Vivi Jul 26 '12 at 10:33
Ah OK. I thought large file and TikZ drawing are different things that need to be compiled together. –  percusse Jul 26 '12 at 10:34
@egreg: I understand what you say about extra_mem_top and extra_mem_bot and I will try that, thanks. I am not sure what you mean by "command shown on the last line", though... –  Vivi Jul 26 '12 at 10:35

I don't think that increasing main_memory is the solution: the default value is very near to the maximum (which depends also on other parameter, on my system the maximum seems to be 12435455), so you get at most a 25% increase in memory.

The parameters to play with are extra_mem_top and extra_mem_bot. The former is for "small objects", the latter for "complex" ones, such as boxes.

For example, in the main texmf.cnf we find

% ConTeXt needs lots of memory.
extra_mem_top.context = 2000000
extra_mem_bot.context = 4000000

so the first suggestion is to set, in the local texmf.cnf file located in /usr/local/texlive/2012,