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 have problem while running xelatex:

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

I tried increasing memory limits in texmf.cnf (also ran fmtutil-sys), but I hit maximum allowed and it still crashes with same error (just different memory amount).

There are no other warnings or errors than one mentioned above (when it crashes).

I use packages: babel, fontenc, inputenc, graphicx, ifthen, multicol, fontspec, xunicode, xltxtra and xcolor.

I use true type font:

\setmainfont{LiberationSansNarrow}

Document is started and ended with commands:

\newcommand{\stardoc}[0]
{
  \begin{multicols}{4}
}


\newcommand{\donedoc}[0]
{
 \end{multicols}
}

(Just wrappers (put in custom class so there can be changed for many documents).

Between multi-columns I include (with \include) "large" file (~3MB) consisting of following commands:

\newcommand{\myrow}[4]
{
 \noindent
 \vbox to 15pt {\vfil
    \hbox to \columnwidth {
      \parbox{0.97\columnwidth}{
        \tiny
        \textbf{#1}\dotfill#3\\
        \emph{#2}\hfill{#4}}%\vspace{6pt}
      }
      \vfil
     }
 }

\newcommand{\myblock}[1]
{
 \noindent
 \colorbox{gray}{
    \vbox to 15pt {\vfil
      \hbox to 0.913\columnwidth {
        \hfill\textbf{{\small #1}}\hfill
      }
      \vfil
    }
  }
}

Here is also end of .log file:

If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

Here is how much of TeX's memory you used:
 6293 strings out of 191470
 96261 string characters out of 1925444
 1500000 words of memory out of 1500000
 9402 multiletter control sequences out of 10000+200000
 6692 words of font info for 33 fonts, out of 1200000 for 2000
 605 hyphenation exceptions out of 8191
 35i,5n,37p,320b,232s stack positions out of 5000i,500n,6000p,200000b,15000s
No pages of output.

If I cut input file to ~30% (~1MB) then everything goes OK and pdf is produced.

I assume there is an error somewhere in custom defined commands as I am not an expert - please help me.

EDIT

Per request in comments, input file is just a series of \myrow and \myblock commands generated from the database.

It works if I add \par before \noindent in any of the commands, but that creates spacings... Is there a way to make \par produce no extra spacings - my layout prior adding \par command was perfect.

share|improve this question

closed as too localized by egreg, lockstep, zeroth, tohecz, Paul Gaborit Sep 27 '12 at 5:55

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.

2  
Welcome to TeX.SX! My suspect is that you're trying to make XeTeX swallow the entire file before making a paragraph. But the information you give is too scarce for making a diagnosis. What's in the file you're inputting? –  egreg Sep 25 '12 at 13:54
2  
Try if it works if you add a \par before \noindent in your commands. If this doesn't help, you will have to make more code accessible. –  Ulrike Fischer Sep 25 '12 at 13:57
1  
TeX always read a complete paragraph in its memory. If the whole text is one large paragraph this will overburden the memory. You will have to adapt your commands so that they use \par at sensible places. –  Ulrike Fischer Sep 25 '12 at 14:47
4  
your text (without the intermediate \par) is just a single paragraph. it would seem that tex can't find a point to break your huge file up into pages. so it tries to fit your 3mbyte file into its 1.5mbyte main memory, and fails. inserted \par tokens give it a break point, so it can form your text into pages, and flush those pages out. a small working document would be good: we could get a feel of what it's like; we definitely don't want you multiple megabutes, just a few rows in as the "rest" of the doc. –  wasteofspace Sep 25 '12 at 14:47
1  
@IvanR -- It is really hard to say what you are doing since you need to post a real and compilable (and minimal) example of the document you have. One thing that sticks out is that your macro definitions seem to introduce a fair amount of spurious space at the start and end of some commands. You are also changing the fontsize with \tiny and \small while using \vbox-es and \vfil-s while all still in the same paragraph. That might do some funky stuff, too. However, I bet someone can fix your problem if you give an example that starts \documentclass and ends \end{document}. –  jon Sep 26 '12 at 7:04

1 Answer 1

So, solution is found - thnx to people in the comments.

Problem with memory was, as stated, that I was trying to chew too much in one paragraph so it broke. First i tried inserting \pre prior to \noindent, but that create the problem of too much spaces between boxes and rows.

That problem was solved by inserting newline at the end of \myrow command, so it looks something like this:

\newcommand{\myrow}[4]
{
 \noindent
 \vbox to 15pt {\vfil
    \hbox to \columnwidth {
      \parbox{0.97\columnwidth}{
        \tiny
        \textbf{#1}\dotfill#3\\
        \emph{#2}\hfill{#4}}%\vspace{6pt}
      }
      \vfil
     }

 }

This creates paragraphs (or something that allows creation of pages before everything is processed in memory), but also doesn't create spaces between boxes and rows.

Thnx everyone

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.