我有一个非常大的文档(>50,000 页),我正在尝试构建它。不幸的是,我遇到了内存错误,因此我尝试增加内存。
在增加内存时,我遇到无法无限增加 main_memory 和 pool_size 的情况。我的最大限制是:
pool_size=40000000
main_memory=99999999
我有一个 64 位 Windows 操作系统,内存为 32GB。有人知道如何增加内存以超过此限制吗?或者这是不可能的吗?
\documentclass[twoside]{book}
% Packages required by doxygen
\usepackage{fixltx2e}
\usepackage{calc}
\usepackage{doxygen}
\usepackage[export]{adjustbox} % also loads graphicx
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage{multicol}
\usepackage{multirow}
\PassOptionsToPackage{warn}{textcomp}
\usepackage{textcomp}
\usepackage[nointegrals]{wasysym}
\usepackage[table]{xcolor}
% Font selection
\usepackage[T1]{fontenc}
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
\usepackage{amssymb}
\usepackage{sectsty}
\renewcommand{\familydefault}{\sfdefault}
\allsectionsfont{%
\fontseries{bc}\selectfont%
\color{darkgray}%
}
\renewcommand{\DoxyLabelFont}{%
\fontseries{bc}\selectfont%
\color{darkgray}%
}
\newcommand{\+}{\discretionary{\mbox{\scriptsize$\hookleftarrow$}}{}{}}
% Page & text layout
\usepackage{geometry}
\geometry{%
letterpaper,%
top=2.5cm,%
bottom=2.5cm,%
left=2.5cm,%
right=2.5cm%
}
\tolerance=750
\hfuzz=15pt
\hbadness=750
\setlength{\emergencystretch}{15pt}
\setlength{\parindent}{0cm}
\setlength{\parskip}{3ex plus 2ex minus 2ex}
\makeatletter
\renewcommand{\paragraph}{%
\@startsection{paragraph}{4}{0ex}{-1.0ex}{1.0ex}{%
\normalfont\normalsize\bfseries\SS@parafont%
}%
}
\renewcommand{\subparagraph}{%
\@startsection{subparagraph}{5}{0ex}{-1.0ex}{1.0ex}{%
\normalfont\normalsize\bfseries\SS@subparafont%
}%
}
\makeatother
% Headers & footers
\usepackage{fancyhdr}
\pagestyle{fancyplain}
\fancyhead[LE]{\fancyplain{}{\bfseries\thepage}}
\fancyhead[CE]{\fancyplain{}{}}
\fancyhead[RE]{\fancyplain{}{\bfseries\leftmark}}
\fancyhead[LO]{\fancyplain{}{\bfseries\rightmark}}
\fancyhead[CO]{\fancyplain{}{}}
\fancyhead[RO]{\fancyplain{}{\bfseries\thepage}}
\fancyfoot[LE]{\fancyplain{}{}}
\fancyfoot[CE]{\fancyplain{}{}}
\fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize Generated by Doxygen }}
\fancyfoot[LO]{\fancyplain{}{\bfseries\scriptsize Generated by Doxygen }}
\fancyfoot[CO]{\fancyplain{}{}}
\fancyfoot[RO]{\fancyplain{}{}}
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}%
}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}%
}
% Indices & bibliography
\usepackage{natbib}
\usepackage[titles]{tocloft}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{5}
\makeindex
% Hyperlinks (required, but should be loaded last)
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex,pagebackref=true]{hyperref}
\else
\usepackage[ps2pdf,pagebackref=true]{hyperref}
\fi
\hypersetup{%
colorlinks=true,%
linkcolor=blue,%
citecolor=blue,%
unicode%
}
% Custom commands
\newcommand{\clearemptydoublepage}{%
\newpage{\pagestyle{empty}\cleardoublepage}%
}
\usepackage{caption}
\captionsetup{labelsep=space,justification=centering,font={bf},singlelinecheck=off,skip=4pt,position=top}
%===== C O N T E N T S =====
\begin{document}
% Titlepage & ToC
\hypersetup{pageanchor=false,
bookmarksnumbered=true,
pdfencoding=unicode
}
\pagenumbering{alph}
\begin{titlepage}
\vspace*{7cm}
\begin{center}%
{\Large D\+A\+S\+Y-\/uc }\\
\vspace*{1cm}
{\large Generated by Doxygen 1.8.12}\\
\end{center}
\end{titlepage}
\clearemptydoublepage
\pagenumbering{roman}
\tableofcontents
\clearemptydoublepage
\pagenumbering{arabic}
\hypersetup{pageanchor=true}
%--- Begin generated contents ---
\chapter{abc}
\label{index}\hypertarget{index}{}\input{index}
\chapter{Test List}
\label{test}
\hypertarget{test}{}
\input{test}
\chapter{Todo List}
\label{todo}
\hypertarget{todo}{}
\input{todo}
\chapter{Bug List}
\label{bug}
\hypertarget{bug}{}
\input{bug}
\chapter{Module Index}
\input{modules}
\chapter{Namespace Index}
\input{namespaces}
\chapter{Hierarchical Index}
\input{hierarchy}
\chapter{Class Index}
\input{annotated}
\chapter{File Index}
\input{files}
\chapter{xyzDocumentation}
\input{aaaa}
\include{yyyy}
\include{xxx}
答案1
您也许能够使用使用动态内存分配的 luatex,但对于非 luatex,texlive 2017 texmf.cnf 说:
% Memory. Must be less than 8,000,000 total.
%
% main_memory is relevant only to initex, extra_mem_* only to non-ini.
% Thus, have to redump the .fmt file after changing main_memory; to add
% to existing fmt files, increase extra_mem_*. (To get an idea of how
% much, try \tracingstats=2 in your TeX source file;
% web2c/tests/memtest.tex might also be interesting.)
%
% To increase space for boxes (as might be needed by, e.g., PiCTeX),
% increase extra_mem_bot.
%
% For some xy-pic samples, you may need as much as 700000 words of memory.
% For the vast majority of documents, 60000 or less will do.
%
main_memory = 5000000 % words of inimemory available; also applies to inimf&mp
extra_mem_top = 0 % extra high memory for chars, tokens, etc.
extra_mem_bot = 0 % extra low memory for boxes, glue, breakpoints, etc.
% ConTeXt needs lots of memory.
extra_mem_top.context = 2000000
extra_mem_bot.context = 4000000
注意第一行。
然而,正如问题下方的评论所指出的那样,几乎所有的内存都会在每一页被运出时被回收,所以除非你有一个浮动的僵局将所有图像带到最后并且不会释放任何内存,否则很少会接近这些限制。
答案2
至于main_memory
,最大值已经是
main_memory=12435455
已经有一段时间了(几个 TeXLive 版本)。可以通过二分法找到。
对于 MiKTeX,限制可能有所不同。
更改配置文件中的值后,必须重建格式才能生效。
TeXLive 的步骤:
运行:
kpsewhich texmf.cnf
在命令行上在返回的文件中,更改/添加
main_memory=12435455
重建格式文件:
fmtutil-sys --all
MiKTeX 的步骤,例如pdflatex
:
initexmf --edit-config-file=pdflatex
- 改变价值
main_memory
- 重建格式:
initexmf --dump=pdflatex
对其他引擎/格式重复这些步骤。