Unable to obtain mapped memory

Product: Intel® C++ Compiler

Operating System: Windows*

Problem Description:
Compilation failed when using precompiled headers with error message: unable to obtain mapped memory (see pch_diag.txt)
Precompiled headers(PCH) are used to reduce compilation time. To achieve this, the compilation result of the header files is stored in binary files with the suffix .pchi. For the next compilation the PCHs are directly loaded into memory. They have to be loaded on the exact same memory address where they were created. The default address used is 0x30000000 in virtual memory.
If the memory address is already used by another program or library the compilation will fail with the error: “unable to obtain mapped memory (see pch_diag.txt)”. As newer versions of windows are using Address Space Layout Randomization (ASLR) more and more, the probability that the default memory location is already in use increases. Due the nature of the ASLR it isn’t predictable how often the error will occur.

Resolution Status:
A compiler switch is available to choose a different memory location.
An internal compiler switch lets you choose the start address in memory of the PCH. To find a proper memory address you can look in the pch_diag.txt file or use a program that shows you the virtual memory map of a process(like VMMap from Sysinternals/Microsoft). The pch_diag.txt file will be automatically created if the error occurs.
Before starting to investigate you can try the memory location 0x20000000 which often solves the issue. To do this, append the following parameter to your compiler command line (address in decimal format for compiler 12.0 Update 4 and below):


For Compiler 12.0 Update 5 and later:
If this doesn’t solve the issue, the pch_diag.txt file shows you the virtual memory map of the compiler address space for the failed compilation. It looks like:
=== Dumping Virtual Address Space Info ===
Page size: 00001000 
Minimum application address: 00010000 
Maximum application address: FFFEFFFF 
Base Address: 00033000 
Region Size: 0000D000 
Base Address: 1008B000 
Region Size: 00075000 
Base Address: 4494E000 
Region Size: 2B6A2000 
Largest Region: 7FFF0000 size: 7FFC0000

The Base Address indicates the start of a reserved/used memory region and the Region Size the length. To find a proper memory location the one right below 0x30000000 is of interest. In this example this is: 0x1008B000. After adding the size of the Region you have a new memory address for your PCH. In this example this would be:

0x1008B000 + 0x00075000 = 0x10100000

There should always be some space between the end of the last reserved/uses memory location and the PCH. A proper address would therefore be 0x11000000. The parameters for the compiler would look like:


For Compiler 12.0 Update 5 and later:

The provided parameter is an internal. It may change anytime.

For more complete information about compiler optimizations, see our Optimization Notice.


MAD\aweggerl's picture

Nikhil can you please open a ticket at premier.intel.com so that we can provide dedicated support for your case?


The /QOption described above doesn't work. Problem still exists in v 16.0.

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.