[OS X TeX] Fontspec and memory management

Herbert Schulz herbs at wideopenwest.com
Sun Jul 7 13:26:40 CEST 2013

On Jul 7, 2013, at 3:59 AM, Jacques ANDRÉ <jacques.andre35 at gmail.com> wrote:

> The following program (obviously it is a minimal extract to show the problem) loops on MacOSX 10.8.2, and TeXLive 2013:
> %!TEX encoding = UTF-8 Unicode 
> \documentclass{article} 
> \usepackage{fontspec}
> \usepackage{multido}
> \newcounter{ctr}
> \begin{document}
> \multido{\ia=0+1}{130000}{\setcounter{ctr}{\ia}} % runs OK 
> \multido{\ia=0+1}{100000}{\fontspec{Arial}}% OK
> \multido{\ia=0+1}{110000}{\fontspec{Arial}}% TeX capacity exceeded, sorry [number of strings=494718].
> \end{document}
> as if fontspec leaves "something" in core memory. Bug or feature?
> Jacques André


While this may represent a memory leak, I'm no expert on that, it is certainly NOT the way to do this since it has to recalculate the setting for Arial on each \fontspec. It is much faster to define a \newfontfamily or \newfontface and then re-use the information.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

More information about the macostex-archives mailing list