/Zm (Specify Precompiled Header Memory Allocation Limit)
Determines the amount of memory that the compiler allocates to construct precompiled headers.
A scaling factor that determines the amount of memory that the compiler uses to construct precompiled headers.
The factor argument is a percentage of the default size of a compiler-defined work buffer. The default value of factor is 100 (percent), but you can specify larger or smaller amounts.
In versions before Visual Studio 2015, the C++ compiler used several discrete heaps, and each had a finite limit. Currently, the compiler dynamically grows the heaps as necessary up to a total heap size limit, and allows the precompiled header to comprise multiple address ranges. Consequently, the /Zm compiler option is rarely necessary.
If the compiler runs out of heap space and emits the C1060 error message when you use the /Zm compiler option, you might have reserved too much memory. Consider removing the /Zm option.
If the compiler emits the C1076 error message, an accompanying C3859 message specifies the factor argument to use when you recompile by using the /Zm compiler option. This message is only significant when a precompiled header uses
#pragma hdrstop. In other cases, it is a spurious error caused by Windows virtual memory pressure issues, and the recommendation to use the /Zm option should be ignored. Instead, consider reducing the number of parallel processes when 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.
The following table shows how the factor argument affects the memory allocation limit if you assume the size of the default precompiled header buffer is 75 MB.
|Value of factor||Memory allocation limit|
Other Ways to Set the Memory Allocation Limit
To set the /Zm compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
In the navigation pane, select Configuration Properties > C/C++ > Command Line.
Enter the /Zm compiler option in the Additional Options box.
To set the /Zm compiler option programmatically
- See AdditionalOptions.