changeset 14962:0d7b83e45b9a

8257746: Regression introduced with JDK-8250984 - memory might be null in some machines Reviewed-by: hseigel, mbaesken
author poonam
date Thu, 28 Jan 2021 15:07:03 +0000
parents 6a3692d3aef6
children 58c877fb68d2
files src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java	Tue Feb 16 10:38:42 2021 +0000
+++ b/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java	Thu Jan 28 15:07:03 2021 +0000
@@ -474,14 +474,14 @@
     }
 
     public long getMemoryAndSwapFailCount() {
-        if (!memory.isSwapEnabled()) {
+        if (memory != null && !memory.isSwapEnabled()) {
             return getMemoryFailCount();
         }
         return SubSystem.getLongValue(memory, "memory.memsw.failcnt");
     }
 
     public long getMemoryAndSwapLimit() {
-        if (!memory.isSwapEnabled()) {
+        if (memory != null && !memory.isSwapEnabled()) {
             return getMemoryLimit();
         }
         long retval = SubSystem.getLongValue(memory, "memory.memsw.limit_in_bytes");
@@ -500,14 +500,14 @@
     }
 
     public long getMemoryAndSwapMaxUsage() {
-        if (!memory.isSwapEnabled()) {
+        if (memory != null && !memory.isSwapEnabled()) {
             return getMemoryMaxUsage();
         }
         return SubSystem.getLongValue(memory, "memory.memsw.max_usage_in_bytes");
     }
 
     public long getMemoryAndSwapUsage() {
-        if (!memory.isSwapEnabled()) {
+        if (memory != null && !memory.isSwapEnabled()) {
             return getMemoryUsage();
         }
         return SubSystem.getLongValue(memory, "memory.memsw.usage_in_bytes");