Skip to content

Commit 42e940c

Browse files
joaocgreisevanlucas
authored andcommitted
build,win: limit maxcpucount to 2 for MSBuild
MSBuild invokes cl.exe with /MP (set in common.gypi), making it compile sources in parallel using a number of internal processes equal to the number of effective processors. MSBuild /m uses a similar mechanism, so the number of compiler processes can grow to the number of effective processors squared. This limits MSBuild to 2 processes, to still use some parallelization while requiring less memory. Cl.exe is still invoked with /MP, thus the maximum number of processes is limited to twice the number of effective processors. PR-URL: #12184 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 1ab998f commit 42e940c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vcbuild.bat

+3-1
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,11 @@ echo Project files generated.
187187
if defined nobuild goto sign
188188

189189
@rem Build the sln with msbuild.
190+
set "msbcpu=/m:2"
191+
if "%NUMBER_OF_PROCESSORS%"=="1" set "msbcpu=/m:1"
190192
set "msbplatform=Win32"
191193
if "%target_arch%"=="x64" set "msbplatform=x64"
192-
msbuild node.sln /m /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
194+
msbuild node.sln %msbcpu% /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
193195
if errorlevel 1 goto exit
194196
if "%target%" == "Clean" goto exit
195197

0 commit comments

Comments
 (0)