8323640: [TESTBUG]testMemoryFailCount in jdk/internal/platform/docker/TestDockerMemoryMetrics.java always fail because OOM killed

Reviewed-by: sgehwolf
This commit is contained in:
sendaoYan 2024-01-23 13:19:49 +00:00 committed by Severin Gehwolf
parent bcaad515fd
commit 791b427f44

@ -72,12 +72,12 @@ public class MetricsMemoryTester {
} else {
long count = Metrics.systemMetrics().getMemoryFailCount();
// Allocate 512M of data
byte[][] bytes = new byte[64][];
// Allocate 512M of data in 1M chunks per iteration
byte[][] bytes = new byte[64 * 8][];
boolean atLeastOneAllocationWorked = false;
for (int i = 0; i < 64; i++) {
for (int i = 0; i < 64 * 8; i++) {
try {
bytes[i] = new byte[8 * 1024 * 1024];
bytes[i] = new byte[1024 * 1024];
atLeastOneAllocationWorked = true;
// Break out as soon as we see an increase in failcount
// to avoid getting killed by the OOM killer.