Skip to content

Commit

Permalink
Make sure we only need one env var
Browse files Browse the repository at this point in the history
  • Loading branch information
schmelter-sap committed Sep 23, 2023
1 parent 3f48433 commit 0db099d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/hotspot/os/posix/malloctrace/mallocTrace2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1655,9 +1655,10 @@ void MallocStatistic::initialize() {

mallocStatImpl::MallocStatisticImpl::initialize();

bool dump_via_env = DEBUG_ONLY(::getenv("MALLOC_TRACE_TEST_DUMP") != NULL) NOT_DEBUG(false);
bool start_via_env = DEBUG_ONLY(::getenv("MALLOC_TRACE_AT_STARTUP") != NULL) NOT_DEBUG(false);

if (start_via_env || MallocTraceAtStartup) {
if (start_via_env || dump_via_env || MallocTraceAtStartup) {
TraceSpec spec;
stringStream ss;

Expand All @@ -1669,13 +1670,12 @@ void MallocStatistic::initialize() {

// Don't fail when enabled via environment, since we use this
// when we have no real control over the started VM.
if (!enable(&ss, spec) && !start_via_env && MallocTraceExitIfFail) {
if (!enable(&ss, spec) && !start_via_env && !dump_via_env && MallocTraceExitIfFail) {
fprintf(stderr, "%s", ss.base());
os::exit(1);
}
}

bool dump_via_env = DEBUG_ONLY(::getenv("MALLOC_TRACE_TEST_DUMP") != NULL) NOT_DEBUG(false);

if (dump_via_env || MallocTraceTestDump) {
char const* file = dump_via_env ? ::getenv("MALLOC_TRACE_TEST_DUMP") : MallocTraceTestDumpOutput;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ const int ObjectAlignmentInBytes = 8;
"If enabled we do a dump of the malloc trace in regular " \
"intervals.") \
\
product(uintx, MallocTraceTestDumpInterval, 60, \
product(uintx, MallocTraceTestDumpInterval, 10, \
"The interval in seconds for the test dump.") \
\
product(ccstr, MallocTraceTestDumpSort, "", \
Expand Down

0 comments on commit 0db099d

Please sign in to comment.