I had a similar issue (also template-heavy), and I was already using /Zm1000
to compile my code (which worked initially). However, after cleaning-up the code, dividing long functions to smaller ones, putting stuff to namespaces / etc., the compiler would spit out the error message:
fatal error C1060: compiler is out of heap space.
right after starting, without any delay (not actually seeming to compile anything). At first, I was confused, as I have 32 GB of swap space and only about 6.1 GB was used at the time. I'm also running x64 OS, so there should be a plenty of memory and swap for everyone.
I referred to MSDN and found out that I actually needed to lower to /Zm800
and now it works great. My understanding is that taking up all heap space for the precompiled header buffer actually locks out the memory space; so using /Zm2000
would leave a 32-bit compiler without means to dynamically allocate memory for other stuff (which it somehow also needs, making the /Zm
option completely ridiculous - use with caution).
I'm using MSVC 6.0, but I hope this helps in 2010 as well.