Skip to content

Commit 6cfedf0

Browse files
committed
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 eb49d59 commit 6cfedf0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vcbuild.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,11 @@ echo Project files generated.
190190
if defined nobuild goto sign
191191

192192
@rem Build the sln with msbuild.
193+
set "msbcpu=/m:2"
194+
if "%NUMBER_OF_PROCESSORS%"=="1" set "msbcpu=/m:1"
193195
set "msbplatform=Win32"
194196
if "%target_arch%"=="x64" set "msbplatform=x64"
195-
msbuild node.sln /m /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
197+
msbuild node.sln %msbcpu% /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
196198
if errorlevel 1 goto exit
197199
if "%target%" == "Clean" goto exit
198200

0 commit comments

Comments
 (0)