Large datafile for pgfplots table gives out of memory

1,099

It compiled for me with --extra-mem-top=10000000 (I didn't use the externalization, if you use it you will have to add the option to the program call used by the externalization code, see the documentation.).

Share:
1,099

Related videos on Youtube

Enlico
Author by

Enlico

Updated on January 08, 2020

Comments

  • Enlico
    Enlico almost 4 years

    I have a problem with 3D plots (surf, contours, ...) when loading "large" tables of data. I get the error ! TeX capacity exceeded, sorry [main memory size=3000000]..

    I found an aswer here, in particular to use pdflatex --enable-write18 --extra-mem-bot=10000000 --synctex=1 <filename> (since I'm a MikTeX user), but it doesn't work at all and I simply get ! TeX capacity exceeded, sorry [main memory size=13000000]..

    Maybe it's important that I use TeXnicCenter, so I simply put --extra-mem-bot=10000000 in the proper option as you can see here (-synctex=-1 -interaction=nonstopmode "%Wm" -synctex=1 -shell-escape --extra-mem-bot=10000000), but I always get memory errors. To give maximum info, I uploaded the log file too.

    The MWE is the following (I apologize if it includes more packages than necessary, but now I'm in total panic). As you can see I try to externalize, but it doesn't work anyway.

    If more information is needed for you to help me, please, let me know.

    \documentclass[a4paper,11pt]{book}
    
    \usepackage{xcolor}
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath,amsfonts,amssymb}
    \usepackage{geometry}
    \usepackage{bm}
    \usepackage{calc}
    \usepackage{tikz}
    \usetikzlibrary{calc,decorations,patterns,shapes.arrows}
    \usepackage{mathtools}
    \usepackage{tikzscale}
    \usetikzlibrary{external}
    \tikzexternalize
    \usepackage{pgfplots}
    \pgfplotsset{compat=newest}
    \usepgfplotslibrary{groupplots,colormaps}
    \usepackage[font=small,
                format=hang,
                labelfont={sf,bf},
                tableposition=top,
                figureposition=bottom]{caption}
    
    
    \begin{document}
    
    
    \begin{figure}[!h]
        \centering
       \begin{tikzpicture}
          \begin{axis}[mesh]
             % the following works (it's 31x31 grid)
             %\addplot3[mesh/rows=31,mesh/cols=31,mesh/ordering=colwise,shader=interp] table[x=X,y=Y,z=psi] {immagini/data/SPIKE_30x30_Re1000_it10000_psi.dat};
             % whereas the following doesn't, for being 101x101
             \addplot3[mesh/rows=101,mesh/cols=101,mesh/ordering=colwise,shader=interp] table[x=X,y=Y,z=psi] {immagini/data/SPIKE_100x100_Re1000_it10000_psi.dat};
          \end{axis}
       \end{tikzpicture}
        \caption{Stream lines and contours of pressure.}
        \label{fig:SPIKE_30x30_Re1000_it10000_p_psi}
    \end{figure}
    
    
    \end{document}
    

    The datafile is downloadable here

    EDIT: I encountered the same problem with the TeXLive distribution on a Mac OS X (using TeXShop as editor). Here is the question I posted, along with my self-answer, which can be an answer to the present question too (to use LuaLaTeX).

    • Ulrike Fischer
      Ulrike Fischer about 8 years
      It compiled for me with --extra-mem-top=10000000 (I didn't use the externalization, if you use it you will have to add the option to the program call used by the externalization code, see the documentation.).
    • Enlico
      Enlico about 8 years
      Ops.. In the answer I referenced there is an error: --extra-mem-bot=10000000 instead of --extra-mem-top=10000000. I changed to top and now the problem is fixed
    • Tom Bombadil
      Tom Bombadil about 8 years
      @UlrikeFischer: Could you please add this as an answer so that this question is no longer unanswered?
  • Enlico
    Enlico about 8 years
    Would it be useful to write explicitly that my error was to write bot instead of top?
  • Ulrike Fischer
    Ulrike Fischer about 8 years
    Well the error was not to check the documentation. Then you would have seen that there are two options for "main memory" and got the idea to try out the other one. docs.miktex.org/2.9/manual/pdftex.html.