From 42e940c5e98ee80d9f98f0de6af9399e747fc2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Tue, 4 Apr 2017 21:01:24 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/12184 Reviewed-By: Refael Ackermann Reviewed-By: Ben Noordhuis --- vcbuild.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vcbuild.bat b/vcbuild.bat index 01750a4a004819..58594bdf612c26 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -187,9 +187,11 @@ echo Project files generated. if defined nobuild goto sign @rem Build the sln with msbuild. +set "msbcpu=/m:2" +if "%NUMBER_OF_PROCESSORS%"=="1" set "msbcpu=/m:1" set "msbplatform=Win32" if "%target_arch%"=="x64" set "msbplatform=x64" -msbuild node.sln /m /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo +msbuild node.sln %msbcpu% /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 goto exit if "%target%" == "Clean" goto exit