mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-28 16:50:10 +00:00
Handle potential failure better
This commit is contained in:
parent
ae42db36e0
commit
b05454bcab
@ -412,8 +412,10 @@ JVM_END
|
||||
|
||||
JVM_ENTRY_NO_ENV(jlong, jfr_host_memory_usage(JNIEnv* env, jclass jvm))
|
||||
physical_memory_size_type memory_usage = 0;
|
||||
// Return value ignored - defaulting to 0 on failure.
|
||||
(void)os::Machine::used_memory(memory_usage);
|
||||
if (!os::Machine::used_memory(memory_usage)) {
|
||||
// Return -1 to signal failure to get memory usage.
|
||||
return static_cast<jlong>(-1);
|
||||
}
|
||||
return static_cast<jlong>(memory_usage);
|
||||
JVM_END
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user