4.11 How to increase memory for Latex?

sudo vi /usr/local/texlive/2015/texmf.cnf
 

Added these:

% (Public domain.) 
% This texmf.cnf file should contain only your personal changes from the 
% original texmf.cnf (for example, as chosen in the installer). 
% 
% That is, if you need to make changes to texmf.cnf, put your custom 
% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than 
% the distributed file (which is .../texlive/YYYY/texmf-dist/web2c/texmf.cnf). 
% And include *only* your changed values, not a copy of the whole thing! 
% 
 
buf_size=9000000 
pool_size=9000000 
main_memory=8000000 
save_size=1000000 
max_strings = 5000000 
strings_free = 1000000 
hash_extra=10000000 
stack_size=500000
 

Then run

sudo -E env "PATH=$PATH" fmtutil-sys --all