# How to Increase MikTeX 2.9 Memory

I was recently running some large stochastic simulations and was generating very large pgfplot data files. MikTeX out of the box was unable to compile these plots because it kept running out of main memory. To increase main memory (or other memory limits) run the following line from the DOS prompt:

` initexmf --edit-config-file pdflatex `

This will open the configuration file for pdflatex into an editor (probably notepad). Add the following lines to this configuration file:
``` pool_size=5000000 main_memory=6000000 extra_mem_bot=2000000 font_mem_size=2000000 ```

I needed lots of memory so these numbers are quite bit. I’ve got 8GB of RAM so let’s be generous (My first computer was the MK14 which had 256 bytes of RAM, things have moved on a little).

Save the file (file name is provided) and then remake the format files. To do this use the command line:

` initexmf --dump=pdflatex `

I happen to use pdflatex all the time so note that I am specifying pdflatex in each of the commands. If you’re using straight latex then substitute pdflatex with latex.

Talking about big tikz/pfdplot figures, don’t forget to use the external command:

```\usepackage{tikz} \usetikzlibrary{external} \tikzexternalize % activate! ```

This forces tikz to reuse previously stored figures, saves regenerating them all the time. See section 32 of the TikZ manual (Version 2.10 !) for more details.

This entry was posted in LaTeX, Publishing. Bookmark the permalink.