question

DTL avatar image
0 Votes"
DTL asked DTL commented

"compiler is out of heap space" when running code analysis on VC++ solution

I have a solution containing several C++ projects that will build a VC++ MFC application. Normal build times for the solution are around 7 minutes.

When I run msbuild /p:RunCodeAnalysis=true /p:Configuration=Release /p:Platform=x64 /v:q MyApp.sln the build fails with "compiler is out of heap space". I've tried turning off precompiled headers as suggested at vs2013-quotfatal-error-c1060-compiler-is-out-of-heap-spacequot-on-building-for-code-analysis but I get the same "compiler is out of heap space" error. The request fails after about 40 minutes.

What other options are available to avoid this error when generating code analysis reports?

c++
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you run code-analysis on individual projects OK? From VS, right click on the project in Solution Explorer.

0 Votes 0 ·

1 Answer

RLWA32-6355 avatar image
0 Votes"
RLWA32-6355 answered DTL commented
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks. I managed to have cl.exe compiler run as 64-bit using

 $env:PreferredToolArchitecture="x64"; msbuild -m /p:RunCodeAnalysis=true /p:Configuration=Release /p:Platform=x64 /v:q MyApp.sln

This would still run msbuild as 32-bit but the Microsoft® C/C++ Compiler Driver (cl.exe) it launches would be 64-bit and resolved the heap errors. I also added the -m switch to MSBuild to build multiple projects in parallel.

0 Votes 0 ·