Pander pander at users.sourceforge.net
Wed Oct 13 12:44:43 CEST 2010

On Mon, October 11, 2010 12:06, Philip Taylor (Webmaster, Ret'd) wrote:
>
>
> Pander wrote:
>
>> Will Robertson, the author from fontspec, proposed the following for me
>> to
>> test:
>>
>> [[ begin quote ]]
>>
>> Use a plain XeTeX document without fontspec and load lots of fonts with
>> commands like this:
>>
>> \def\testfont#1#2{%
>>    \font#1="#2" at 12pt#1 A test of the font "#2"\par
>> }
>> \testfont\aaa{Palatino Linotype}
>> \testfont\bbb{Georgia}
>>
>> You should see an increase in the memory numbers reported at the end of
>> the XeTeX run (in the log file if not on the console) the more fonts you
>>
>> If you then write
>>
>> \let\aaa\relax
>> \let\bbb\relax
>> ...
>>
>> the fonts may or may not be unloaded and the memory results will change.
>> You could also experiment with putting the font loading calls inside
>> groups and see if that changes things as well.
>
> It is too long since I looked inside TeX to be sure of this,
> but it /may/ be that you will need to unload the fonts in
> the reverse order that in which they were loaded in order
> to regain all of the space allocated.
>
> Philip Taylor
>

According to Hans Hagen one does not want to do this for the following,
important, reason. In the glyph nodes of a saved box or part of a page
which has not been rendered yet, a reference can exist to a font. An
unload would have to be blocked if such references exist. This would be
complex, let alone that the unloading is even possible in the first place.

Alternatives for me, and all others running into this problem, is running
either luatex or splitting it all up in parts and concatenating the PDFs
later on.

Regards,

Pander