I'm playing around with parser combinators and have some template heavy code (lots of functions templatized over lambdas). When I try to compile it cl.exe runs up to around 660 MB of memory usage (according to Task Manager), then fails with "C1060: compiler out of heap space". I have plenty more memory available on my system (16 GB + swap file, and only half of that is being used by other processes), so I don't understand why I'm getting this error.
I have read all of the other threads about this issue and the MSDN page and tried their solutions.
- Switching to the 64 bit tool architecture made the problem go away for awhile, but when my project got bigger the error returned, even though cl.exe is still nowhere near either physical or virtual memory limits.
- /Zm did not have any effect whether I set it high or low, I'm not using precompiled headers anyways.
- Changing /MP (multi-process compilation), whether enabling it or disabling it, had no effect.
I'm using Visual Studio Community Edition 2019 v16.11.5 and compiling with /std:c++20, if it matters.
I've pasted my code to Godbolt, though I don't know how to use multi-file projects on Godbolt so this is just to share it. If I comment out various sections of code in ExpandBrace.cpp it compiles successfully in MSVC, so I think this is an actual memory issue and is not tied to any error in the code.
I'm pretty sure my project would compile if cl.exe would use more memory before giving up, but I can't find any way to raise it's heap memory limit.