From e9f0ba96ab18d985618de66b448602dd4ecd4a1c Mon Sep 17 00:00:00 2001 From: s50600822 Date: Thu, 29 Feb 2024 13:45:58 +1100 Subject: [PATCH] demonstrate jdk cgroup bug - incl mem --- vs/java/cgroup/CgroupConfigPrinter.java | 11 +++++++++++ vs/java/cgroup/application.jar | Bin 1142 -> 1293 bytes vs/java/cgroup/runWithDocker.sh | 2 +- vs/java/cgroup/runWithDockerJ8.sh | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/vs/java/cgroup/CgroupConfigPrinter.java b/vs/java/cgroup/CgroupConfigPrinter.java index a7b0caf..dea57f0 100644 --- a/vs/java/cgroup/CgroupConfigPrinter.java +++ b/vs/java/cgroup/CgroupConfigPrinter.java @@ -1,3 +1,6 @@ +import java.lang.management.ManagementFactory; +import com.sun.management.OperatingSystemMXBean; + public class CgroupConfigPrinter { public static void main(String[] args) { int availableProcessors = Runtime.getRuntime().availableProcessors(); @@ -14,5 +17,13 @@ public static void main(String[] args) { System.out.println("Available Memory (Total): " + totalMemoryMB + " MB"); System.out.println("Available Memory (Free): " + freeMemoryMB + " MB"); System.out.println("Maximum Memory (Allocated): " + maxMemoryMB + " MB"); + + OperatingSystemMXBean osBean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); + + // deprecated in favor of getTotalMemorySize(), however new method is not avail on JDK8 + // keeps this so we can test against 8 and above + long totalSystemMemoryBytes = osBean.getTotalPhysicalMemorySize(); + long totalSystemMemoryMB = totalSystemMemoryBytes / (1024 * 1024); + System.out.println("Total System Memory: " + totalSystemMemoryMB + " MB"); } } diff --git a/vs/java/cgroup/application.jar b/vs/java/cgroup/application.jar index c29689d2c065f63dfb81096c9ab246902f739be1..35bdd87518a23f7a2a73d78a90a24852c1a0a644 100644 GIT binary patch delta 908 zcmV;719SZL2#pF1P)h>@3IG5I001IwkqjvUB5jd3odP0lk=84Jg;ZNp(?AsdR!S2> zpp;9ws__P?7wWxA5vA2Cl>$<{jZd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