From 40febba0c4d91850a90b5611721676f417ac7bac Mon Sep 17 00:00:00 2001 From: Aleksandar Micic Date: Thu, 5 Dec 2024 13:32:39 -0500 Subject: [PATCH] SoftMx test, touch memory When allocating large arrays we now touch memory. This should help with more precise/deterministic calculation of OS physical free memory. This is particularly important for Balanced Offheap, which has lazy commit of newly allocated Offheap arrays. Signed-off-by: Aleksandar Micic --- .../JLM_Tests/src/j9vm/test/softmx/MemoryExhauster.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/functional/JLM_Tests/src/j9vm/test/softmx/MemoryExhauster.java b/test/functional/JLM_Tests/src/j9vm/test/softmx/MemoryExhauster.java index a9f3939a49b..46d75d80b0e 100644 --- a/test/functional/JLM_Tests/src/j9vm/test/softmx/MemoryExhauster.java +++ b/test/functional/JLM_Tests/src/j9vm/test/softmx/MemoryExhauster.java @@ -61,7 +61,14 @@ public boolean usePercentageOfHeap( double percentage ) { try { while ( ibmMemoryMBean.getHeapMemoryUsage().getCommitted() < ((long) ( original_softmx_value * percentage ))){ try { - myObjects[i] = new byte[OBJECT_SIZE]; + byte myObject[] = new byte[OBJECT_SIZE]; + + myObjects[i] = myObject; + + for (int j = 0; j < OBJECT_SIZE; j += 4 * 1024) { + myObject[j] = (byte)(i + 1); + } + i++; } catch (OutOfMemoryError e){ // at this point we stop