Skip to content

Commit 40febba

Browse files
Aleksandar MicicAleksandar Micic
Aleksandar Micic
authored and
Aleksandar Micic
committed
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 <[email protected]>
1 parent 9f917f5 commit 40febba

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/functional/JLM_Tests/src/j9vm/test/softmx/MemoryExhauster.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ public boolean usePercentageOfHeap( double percentage ) {
6161
try {
6262
while ( ibmMemoryMBean.getHeapMemoryUsage().getCommitted() < ((long) ( original_softmx_value * percentage ))){
6363
try {
64-
myObjects[i] = new byte[OBJECT_SIZE];
64+
byte myObject[] = new byte[OBJECT_SIZE];
65+
66+
myObjects[i] = myObject;
67+
68+
for (int j = 0; j < OBJECT_SIZE; j += 4 * 1024) {
69+
myObject[j] = (byte)(i + 1);
70+
}
71+
6572
i++;
6673
} catch (OutOfMemoryError e){
6774
// at this point we stop

0 commit comments

Comments
 (0)