aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2016-03-23 17:26:12 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-03-24 10:31:43 +0000
commit8cc772ef98604678d99b6a685e412a11a6508ba5 (patch)
tree59e3b96e6813a04ca9d8692529850e7c90f171d8 /src/main/cpp
parentb92c097ffac2e2e50632fc0a6e4f6909386aee45 (diff)
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
Diffstat (limited to 'src/main/cpp')
-rw-r--r--src/main/cpp/blaze.cc3
-rw-r--r--src/main/cpp/blaze_startup_options.cc1
-rw-r--r--src/main/cpp/blaze_startup_options.h2
-rw-r--r--src/main/cpp/blaze_startup_options_common.cc14
4 files changed, 20 insertions, 0 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
index 0fa9b75535..ab185c2fbf 100644
--- a/src/main/cpp/blaze.cc
+++ b/src/main/cpp/blaze.cc
@@ -280,7 +280,10 @@ static vector<string> GetArgumentArray() {
}
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 7a27abe1ec..2a16cf5e58 100644
--- a/src/main/cpp/blaze_startup_options.cc
+++ b/src/main/cpp/blaze_startup_options.cc
@@ -52,6 +52,7 @@ BlazeStartupOptions::BlazeStartupOptions(const BlazeStartupOptions &rhs)
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 3e984879b8..41629b2f9b 100644
--- a/src/main/cpp/blaze_startup_options.h
+++ b/src/main/cpp/blaze_startup_options.h
@@ -148,6 +148,8 @@ class BlazeStartupOptions {
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 4b0633593b..086f719b07 100644
--- a/src/main/cpp/blaze_startup_options_common.cc
+++ b/src/main/cpp/blaze_startup_options_common.cc
@@ -49,6 +49,7 @@ void BlazeStartupOptions::Init() {
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 @@ blaze_exit_code::ExitCode BlazeStartupOptions::ProcessArg(
} 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;