Edit

Share via


Fatal Error C1076

compiler limit : internal heap limit reached; use /Zm to specify a higher limit

This error can be caused by too many symbols, or too many template instantiations. Starting in Visual Studio 2015, this message may result from Windows virtual memory pressure caused by too many parallel build processes. In this case, the recommendation to use the /Zm option should be ignored unless you are using a #pragma hdrstop directive.

To resolve this error:

  1. If your precompiled header uses a #pragma hdrstop directive, use the /Zm option to set the compiler memory limit to the value specified in the C3859 error message. For more information that includes how to set this value in Visual Studio, see the Remarks section in /Zm (Specify Precompiled Header Memory Allocation Limit).

  2. Consider reducing the number of parallel processes specified by using the /maxcpucount option to MSBUILD.EXE in conjunction with the /MP option to CL.EXE. For more information, see Precompiled Header (PCH) issues and recommendations.

  3. If you are using the 32-bit hosted compilers on a 64-bit operating system, use the 64-bit hosted compilers instead. For more information, see How to: Enable a 64-Bit Visual C++ Toolset on the Command Line.

  4. Eliminate unnecessary include files.

  5. Eliminate unnecessary global variables—for example, by allocating memory dynamically instead of declaring a large array.

  6. Eliminate unused declarations.

If C1076 occurs immediately after the build starts, the value specified for /Zm is probably too high for your program. Reduce the /Zm value.