This might be related to 38479787/c3859-virtual-memory-range-for-pch-exceeded.
A good read on PCH issues and recommendations can be found here.
After we've upgraded from VS2019 16.6 to VS2019 16.7.6, we're sometimes getting the infamous C3859 error when compiling our MSVC solutions.
- We're using x64 msbuild from the command line.
- /maxcpucount for MSBuild is fixed to '4'
- /MP is passed, we're compiling on 8-core i7 machines.
The exact same source occasionally fails to compile with the errors
- Compiler Error C3859 "virtual memory range for PCH exceeded"
- System Code 1455 "The paging file is too small for this operation to complete."
- Fatal error C1076 "compiler limit : internal heap limit reached"s
sample compilation output:
1342>c1xx : error C3859: Fehler beim Erstellen des virtuellen Speichers für PCH. [C:\REDACTED\REDACTED.vcxproj]
c1xx : message : Das System hat den Code 1455 zurückgegeben: Die Auslagerungsdatei ist zu klein, um diesen Vorgang durchzuführen. [C:\REDACTED\REDACTED.vcxproj]
c1xx : message : Weitere Informationen finden Sie unter https://aka.ms/pch-help. [C:\REDACTED\REDACTED.vcxproj]
1342>c1xx : fatal error C1076: Compilerlimit: Interne Heapgrenze erreicht. [C:\REDACTED\REDACTED.vcxproj]
1342>c1xx : fatal error C1076: Compilerlimit: Interne Heapgrenze erreicht. [C:\REDACTED\REDACTED.vcxproj]
The generated PCHs are up to 300MB in size. Passing the '/Zm' switch (with values up 1000) didn't make a difference.
We've had issues with this years ago, using VS2010 - back then setting '/Zm200' solved the problem for us (note the error codes back then explicitly told us to increase to '/Zm150' or higher).
'reducing the complexity and size of our PCH files' really is not what we want to do - as we're intentionally sacrificing on memory in order to speed up our builds.
I'm wondering if there is a way to figure out what the actual underlying problem is that generates these sporadic occuring errors - and most important: how to fix it .