Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wrote a C++ code, which will create a LaTeX file with Tikz commands. The tex file the code creates is pretty long i.e. around 43,000 lines. However, when I try to compile it gives me the following error.

! TeX capacity exceeded, sorry [main memory size=3000000].

Is there anyway I can circumvent this error?

share|improve this question
You could try luatex which does dynamic memory allocation but that means it may eat all the memory on your machine rather than giving up, it depends how much memory the document really needs –  David Carlisle Oct 19 '12 at 22:06
With such a complicated TikZ code, you'll very likely get some other error after you solve this (for example Dimension too large). I recommend switching to pstricks and precompiling the images, if this is possible. –  tohecz Oct 19 '12 at 23:48
@Philip: No I don't think you also have this problem. You only get the same error message. This error also appears if e.g. an (incorrect) recursive macro builds up the input memory (\def\recmacro{\recmacro Text} would add 'Text' to the input buffer until its full). This append to me with the apacite package recently. Here allocating more memory doesn't help. –  Martin Scharrer Feb 7 '13 at 7:24
@Philip The problem with saying 'I have the same issue' here is that the question is pretty vague: we have no solid example to see if the issue is the length of the file or what it's trying to do. TeX will happily process huge documents, but will run into trouble if you try to do too many (usually graphical) operations on one page. –  Joseph Wright Feb 7 '13 at 8:23
show 5 more comments

closed as too localized by Joseph Wright Nov 21 '12 at 8:36

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.