Skip to content

Commit 957fc68

Browse files
Merge pull request #5532 from Rastaban/docs-editor/compiler-error-c3859-1712274985
Update compiler-error-c3859.md
2 parents 1bfdc15 + def9f9d commit 957fc68

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

docs/error-messages/compiler-errors-2/compiler-error-c3859.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,31 @@ title: "Compiler Error C3859"
44
ms.date: 02/22/2022
55
f1_keywords: ["C3859"]
66
helpviewer_keywords: ["C3859"]
7-
ms.assetid: 40e93b25-4393-4467-90de-035434a665c7
87
---
98
# Compiler Error C3859
109

11-
> virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm*value*' or greater
10+
> Failed to create virtual memory for PCH
1211
13-
The virtual memory allocated for your precompiled header is too small for the amount of data the compiler is trying to put in it. Starting in Visual Studio 2015, the **`/Zm`** recommendation is only significant when using the `#pragma hdrstop` directive. In other cases, it's a spurious error that indicates Windows virtual memory pressure issues.
12+
The message has one of the following notes:
13+
>The system returned code *error code*: *OS error message*\
14+
>PCH: Address is not a multiple of the system's allocation granularity\
15+
>PCH: The chunk has not been previously reserved\
16+
>PCH: Commit size too large\
17+
>PCH: Unable to commit memory across file map\
18+
>PCH: Exhausted chunk list before committing all bytes\
19+
>PCH: Unexpected end of chunk list while trying to free\
20+
>PCH: Shouldn't be hitting a file map in the decommit case\
21+
>PCH: Invalid chunk\
22+
>PCH: Map size too large\
23+
>PCH: Unable to map file: memory already committed\
24+
>PCH: File map already in place\
25+
>PCH: Unable to get the requested block of memory\
26+
>Consider using /Fp to allow the compiler to reserve the memory early
1427
15-
If your precompiled header uses a `#pragma hdrstop` directive, use the **`/Zm`** compiler flag to specify a larger value for the precompiled header file. Otherwise, consider reducing the number of parallel compilation processes in your build. For more information, see [`/Zm` (Specify precompiled header memory allocation limit)](../../build/reference/zm-specify-precompiled-header-memory-allocation-limit.md).
28+
There isn't enough virtual memory allocated for your [precompiled header (PCH)](../../build/creating-precompiled-header-files.md). If your precompiled header uses an explicit `#pragma hdrstop` directive, use the **`/Zm`** compiler flag to specify a larger value for the precompiled header file. Otherwise, consider reducing the number of parallel compilation processes in your build. For more information, see [`/Zm` (Specify precompiled header memory allocation limit)](../../build/reference/zm-specify-precompiled-header-memory-allocation-limit.md).
29+
30+
This diagnostic shows up mostly in two scenarios:
31+
32+
The first scenario is that the system is overloaded with multiple `/Yu` compile requests at the same time. Setting the maximum starting virtual memory size typically resolves this issue.
33+
34+
The second scenario is when the the Windows loader injects a DLL into the process at startup. That injected DLL can allocate memory that conflicts with where the PCH must reside. For example, `msbuild.exe` injects `FileTracker.dll` into every `CL.exe` process at startup. In this scenario, using the [`/Fp` (Name .pch file)](../../build/reference/fp-name-dot-pch-file.md) flag ensures that the memory for the PCH is allocated as early as possible in the `CL.exe` process, before any injected DLLs try to occupy the address space. These failures can be intermittent because Windows Address Space Layout Randomization (ASLR) allocates memory at different addresses across different process invocations. Without `/Fp`, memory for the PCH can't be allocated until the compiler finds the header file `#include` specified in the `/Yu` command line option or the `#pragma hdrstop`. By this time, it's much more likely that the memory required by the PCH is already reserved.

docs/error-messages/compiler-errors-2/compiler-errors-c3500-through-c3999.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ description: "Learn more about: Compiler errors C3500 through C3999"
33
title: "Compiler errors C3500 through C3999"
44
ms.date: 05/25/2022
55
f1_keywords: ["C3502", "C3503", "C3504", "C3511", "C3512", "C3513", "C3514", "C3515", "C3516", "C3517", "C3518", "C3520", "C3521", "C3522", "C3523", "C3524", "C3525", "C3526", "C3527", "C3528", "C3529", "C3534", "C3542", "C3543", "C3544", "C3545", "C3546", "C3547", "C3548", "C3549", "C3557", "C3558", "C3559", "C3560", "C3561", "C3562", "C3563", "C3564", "C3565", "C3566", "C3567", "C3568", "C3569", "C3570", "C3571", "C3572", "C3573", "C3574", "C3575", "C3576", "C3577", "C3578", "C3579", "C3580", "C3581", "C3582", "C3583", "C3584", "C3585", "C3586", "C3587", "C3588", "C3589", "C3590", "C3591", "C3592", "C3593", "C3594", "C3595", "C3596", "C3597", "C3598", "C3599", "C3600", "C3601", "C3602", "C3604", "C3605", "C3606", "C3613", "C3614", "C3616", "C3617", "C3620", "C3621", "C3635", "C3636", "C3639", "C3643", "C3649", "C3658", "C3659", "C3660", "C3663", "C3664", "C3667", "C3674", "C3676", "C3677", "C3678", "C3679", "C3680", "C3681", "C3682", "C3683", "C3684", "C3685", "C3686", "C3687", "C3688", "C3689", "C3690", "C3691", "C3692", "C3693", "C3694", "C3695", "C3696", "C3700", "C3716", "C3720", "C3725", "C3726", "C3729", "C3730", "C3735", "C3742", "C3746", "C3750", "C3751", "C3756", "C3757", "C3758", "C3759", "C3760", "C3770", "C3773", "C3774", "C3775", "C3776", "C3777", "C3778", "C3780", "C3781", "C3782", "C3783", "C3784", "C3785", "C3786", "C3787", "C3788", "C3789", "C3790", "C3791", "C3792", "C3793", "C3794", "C3795", "C3796", "C3801", "C3802", "C3806", "C3810", "C3811", "C3814", "C3819", "C3822", "C3823", "C3826", "C3827", "C3829", "C3837", "C3840", "C3841", "C3843", "C3844", "C3845", "C3847", "C3863", "C3870", "C3871", "C3875", "C3876", "C3877", "C3878", "C3879", "C3881", "C3882", "C3884", "C3885", "C3897", "C3905", "C3906", "C3907", "C3916", "C3921", "C3924", "C3925", "C3926", "C3927", "C3928", "C3930", "C3931", "C3932", "C3933", "C3934", "C3935", "C3936", "C3937", "C3938", "C3939", "C3940", "C3941", "C3945", "C3946", "C3947", "C3948", "C3949", "C3950", "C3951", "C3952", "C3953", "C3954", "C3955", "C3956", "C3957", "C3958", "C3959", "C3960", "C3961", "C3962", "C3963", "C3964", "C3965", "C3966", "C3967", "C3968", "C3969", "C3970", "C3971", "C3972", "C3973", "C3974", "C3975", "C3976", "C3977", "C3978", "C3979", "C3980", "C3981", "C3982", "C3983", "C3984", "C3985", "C3986", "C3987", "C3988", "C3989", "C3990", "C3991", "C3992", "C3993", "C3994", "C3995", "C3996", "C3997", "C3998", "C3999"]
6-
ms.assetid: bd6f23ad-b300-4e07-8e35-9661cab1585f
76
---
87
# Compiler errors C3500 through C3999
98

10-
The articles in this section of the documentation explain a subset of the error messages that are generated by the compiler.
9+
The articles in this section explain a subset of the error messages generated by the compiler.
1110

1211
[!INCLUDE[error-boilerplate](../../error-messages/includes/error-boilerplate.md)]
1312

@@ -372,7 +371,7 @@ The articles in this section of the documentation explain a subset of the error
372371
|[Compiler error C3856](compiler-error-c3856.md)|'*class*': class is not a class template/generic|
373372
|[Compiler error C3857](compiler-error-c3857.md)|'*template*': multiple template/generic parameter lists are not allowed|
374373
|[Compiler error C3858](compiler-error-c3858.md)|'*identifier*': cannot be redeclared in current scope|
375-
|[Compiler error C3859](compiler-error-c3859.md)|virtual memory range for PCH exceeded; please recompile with a command line option of '`-Zm`*number*' or greater|
374+
|[Compiler error C3859](compiler-error-c3859.md)|Failed to create virtual memory for PCH|
376375
|[Compiler error C3860](compiler-error-c3860.md)|template/generic argument list following class template/generic name must list parameters in the order used in template/generic parameter list|
377376
|[Compiler error C3861](compiler-error-c3861.md)|'*identifier*': identifier not found|
378377
|[Compiler error C3862](compiler-error-c3862.md)|'*function*': cannot compile an unmanaged function with `/clr:pure` or `/clr:safe`|

0 commit comments

Comments
 (0)