Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
/ jdk13u-dev Public archive

Commit c668a0c

Browse files
author
Ekaterina Vergizova
committed
8257746: Regression introduced with JDK-8250984 - memory might be null in some machines
Reviewed-by: sgehwolf Backport-of: abc4300
1 parent a3174be commit c668a0c

File tree

1 file changed

+4
-4
lines changed
  • src/java.base/linux/classes/jdk/internal/platform/cgroupv1

1 file changed

+4
-4
lines changed

src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,14 @@ public long getTcpMemoryUsage() {
474474
}
475475

476476
public long getMemoryAndSwapFailCount() {
477-
if (!memory.isSwapEnabled()) {
477+
if (memory != null && !memory.isSwapEnabled()) {
478478
return getMemoryFailCount();
479479
}
480480
return SubSystem.getLongValue(memory, "memory.memsw.failcnt");
481481
}
482482

483483
public long getMemoryAndSwapLimit() {
484-
if (!memory.isSwapEnabled()) {
484+
if (memory != null && !memory.isSwapEnabled()) {
485485
return getMemoryLimit();
486486
}
487487
long retval = SubSystem.getLongValue(memory, "memory.memsw.limit_in_bytes");
@@ -500,14 +500,14 @@ public long getMemoryAndSwapLimit() {
500500
}
501501

502502
public long getMemoryAndSwapMaxUsage() {
503-
if (!memory.isSwapEnabled()) {
503+
if (memory != null && !memory.isSwapEnabled()) {
504504
return getMemoryMaxUsage();
505505
}
506506
return SubSystem.getLongValue(memory, "memory.memsw.max_usage_in_bytes");
507507
}
508508

509509
public long getMemoryAndSwapUsage() {
510-
if (!memory.isSwapEnabled()) {
510+
if (memory != null && !memory.isSwapEnabled()) {
511511
return getMemoryUsage();
512512
}
513513
return SubSystem.getLongValue(memory, "memory.memsw.usage_in_bytes");

0 commit comments

Comments
 (0)