Skip to content

Commit

Permalink
Cap the number of aapt2 daemons to 6
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Mar 14, 2020
1 parent 7607497 commit 1b3f666
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Xamarin.Android.Tasks {

public abstract class Aapt2 : AndroidAsyncTask {

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

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

0 comments on commit 1b3f666

Please sign in to comment.