Skip to content

Commit abc4300

Browse files
author
Poonam Bajaj
committed
8257746: Regression introduced with JDK-8250984 - memory might be null in some machines
Reviewed-by: hseigel
1 parent 13ca433 commit abc4300

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

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

446446
public long getMemoryAndSwapFailCount() {
447-
if (!memory.isSwapEnabled()) {
447+
if (memory != null && !memory.isSwapEnabled()) {
448448
return getMemoryFailCount();
449449
}
450450
return getLongValue(memory, "memory.memsw.failcnt");
451451
}
452452

453453
public long getMemoryAndSwapLimit() {
454-
if (!memory.isSwapEnabled()) {
454+
if (memory != null && !memory.isSwapEnabled()) {
455455
return getMemoryLimit();
456456
}
457457
long retval = getLongValue(memory, "memory.memsw.limit_in_bytes");
@@ -469,14 +469,14 @@ public long getMemoryAndSwapLimit() {
469469
}
470470

471471
public long getMemoryAndSwapMaxUsage() {
472-
if (!memory.isSwapEnabled()) {
472+
if (memory != null && !memory.isSwapEnabled()) {
473473
return getMemoryMaxUsage();
474474
}
475475
return getLongValue(memory, "memory.memsw.max_usage_in_bytes");
476476
}
477477

478478
public long getMemoryAndSwapUsage() {
479-
if (!memory.isSwapEnabled()) {
479+
if (memory != null && !memory.isSwapEnabled()) {
480480
return getMemoryUsage();
481481
}
482482
return getLongValue(memory, "memory.memsw.usage_in_bytes");

0 commit comments

Comments
 (0)