Skip to content

Commit 1b3f666

Browse files
committed
Cap the number of aapt2 daemons to 6
1 parent 7607497 commit 1b3f666

File tree

1 file changed

+4
-1
lines changed
  • src/Xamarin.Android.Build.Tasks/Tasks

1 file changed

+4
-1
lines changed

src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace Xamarin.Android.Tasks {
2121

2222
public abstract class Aapt2 : AndroidAsyncTask {
2323

24+
private static readonly int DefaultMaxAapt2Daemons = 6;
2425
protected Dictionary<string, string> resource_name_case_map;
2526
public int DaemonMaxInstanceCount { get; set; }
2627

@@ -64,7 +65,9 @@ protected virtual int GetRequiredDaemonInstances ()
6465
public override bool Execute ()
6566
{
6667
// Must register on the UI thread!
67-
int maxInstances = Environment.ProcessorCount-1;
68+
// We don't want to use up ALL the available cores especially when
69+
// running in the IDE. So lets cap it at DefaultMaxAapt2Daemons (6).
70+
int maxInstances = Math.Min (Environment.ProcessorCount-1, DefaultMaxAapt2Daemons);
6871
if (DaemonMaxInstanceCount == 0)
6972
DaemonMaxInstanceCount = maxInstances;
7073
else

0 commit comments

Comments
 (0)