Add startup option --experimental_oom_more_eagerly_threshold, with default value 90. When --experimental_oom_more_eagerly is enabled, if after two full GCs the old gen is still >=--experimental_oom_more_eagerly_threshold% full, exit the JVM.

--
MOS_MIGRATED_REVID=117943361
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
index 0fa9b75..ab185c2 100644
--- a/src/main/cpp/blaze.cc
+++ b/src/main/cpp/blaze.cc
@@ -280,7 +280,10 @@
   }
   if (globals->options.oom_more_eagerly) {
     result.push_back("--experimental_oom_more_eagerly");
+    result.push_back("--experimental_oom_more_eagerly_threshold=" +
+                     ToString(globals->options.oom_more_eagerly_threshold));
   }
+
   if (globals->options.watchfs) {
     result.push_back("--watchfs");
   }
diff --git a/src/main/cpp/blaze_startup_options.cc b/src/main/cpp/blaze_startup_options.cc
index 7a27abe..2a16cf5 100644
--- a/src/main/cpp/blaze_startup_options.cc
+++ b/src/main/cpp/blaze_startup_options.cc
@@ -52,6 +52,7 @@
       io_nice_level(rhs.io_nice_level),
       max_idle_secs(rhs.max_idle_secs),
       oom_more_eagerly(rhs.oom_more_eagerly),
+      oom_more_eagerly_threshold(rhs.oom_more_eagerly_threshold),
       watchfs(rhs.watchfs),
       allow_configurable_attributes(rhs.allow_configurable_attributes),
       option_sources(rhs.option_sources),
diff --git a/src/main/cpp/blaze_startup_options.h b/src/main/cpp/blaze_startup_options.h
index 3e98487..41629b2 100644
--- a/src/main/cpp/blaze_startup_options.h
+++ b/src/main/cpp/blaze_startup_options.h
@@ -148,6 +148,8 @@
 
   bool oom_more_eagerly;
 
+  int oom_more_eagerly_threshold;
+
   // If true, Blaze will listen to OS-level file change notifications.
   bool watchfs;
 
diff --git a/src/main/cpp/blaze_startup_options_common.cc b/src/main/cpp/blaze_startup_options_common.cc
index 4b06335..086f719 100644
--- a/src/main/cpp/blaze_startup_options_common.cc
+++ b/src/main/cpp/blaze_startup_options_common.cc
@@ -49,6 +49,7 @@
   io_nice_level = -1;
   // 3 hours (but only 5 seconds if used within a test)
   max_idle_secs = testing ? 5 : (3 * 3600);
+  oom_more_eagerly_threshold = 90;
   webstatus_port = 0;
   oom_more_eagerly = false;
   watchfs = false;
@@ -212,6 +213,19 @@
   } else if (GetNullaryOption(arg, "--noexperimental_oom_more_eagerly")) {
     oom_more_eagerly = false;
     option_sources["experimental_oom_more_eagerly"] = rcfile;
+  } else if (GetUnaryOption(arg, next_arg,
+                            "--experimental_oom_more_eagerly_threshold") !=
+             NULL) {
+    if (!blaze_util::safe_strto32(value, &oom_more_eagerly_threshold) ||
+        oom_more_eagerly_threshold < 0) {
+      blaze_util::StringPrintf(error,
+                               "Invalid argument to "
+                               "--experimental_oom_more_eagerly_threshold: "
+                               "'%s'.",
+                               value);
+      return blaze_exit_code::BAD_ARGV;
+    }
+    option_sources["experimental_oom_more_eagerly_threshold"] = rcfile;
   } else if (GetNullaryOption(arg, "--watchfs")) {
     watchfs = true;
     option_sources["watchfs"] = rcfile;