# 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`,

``````% Add memory to pdflatex
extra_mem_top.pdflatex = 2000000
extra_mem_bot.pdflatex = 4000000
``````

Setting these values doesn't require to rebuild the formats, as is the case for `main_memory`.

An alternative is to use `lualatex`, which allocates memory in dynamic fashion. The result shouldn't be very different to what's obtained with `pdflatex` (some small changes are possible, because LuaTeX uses slightly different hyphenation algorithms, for instance).

-
the extra memory didn't seem to help much (but then again, I could have kept trying higher numbers). The luatex option, though, worked. I never really understood what luatex was or what it did, and I didn't know how to use it. It compiled the document using all data points without problem! I truly appreciate your help :) – Vivi Jul 26 '12 at 17:38