-
Notifications
You must be signed in to change notification settings - Fork 771
Closed
Description
Running the following test shows a memory leak at runtime/vm/ContinuationHelpers.cpp:132.
import java.util.concurrent.atomic.*;
import java.util.stream.*;
import java.util.*;
public class GTest {
public static void main(String[] args) throws Exception {
GTest gt = new GTest();
long startm = System.currentTimeMillis();
for (int i = 0; i < 2000; i++) {
if ((i + 1) % 200 == 0) {
long currentm = System.currentTimeMillis();
System.out.println("iteration " + i + " time: " + (currentm - startm));
startm = currentm;
Thread.sleep(200);
System.gc();
System.gc();
Thread.sleep(200);
}
gt.test();
}
}
public void test() {
AtomicInteger inc = new AtomicInteger(0);
Stream stream = Stream.generate(inc::getAndIncrement).gather(Gatherers.mapConcurrent(40, num -> num));
Iterator it = stream.iterator();
for (int i = 0; i < 500; i++) {
it.next();
}
}
}
java -Xint -Xcheck:memory:noscan,quick,callsite=1000000 GTest &> output.txt
grep ContinuationHelpers.cpp:132 output.txt
total alloc | total freed | delta alloc | delta freed | high water | largest
blocks| bytes | blocks| bytes | blocks| bytes | blocks| bytes | blocks| bytes | bytes | num | callsite
-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+------------
989949 1383288736 0 0 989949 1383288736 0 0 989949 1383288736 4096 3 /home/jenkins/workspace/build-scripts/jobs/jdk25/jdk25-linux-x64-openj9/workspace/build/src/openj9/runtime/vm/ContinuationHelpers.cpp:132
1989916 2780566632 0 0 999967 1397277896 0 0 1989916 2780566632 4096 3 /home/jenkins/workspace/build-scripts/jobs/jdk25/jdk25-linux-x64-openj9/workspace/build/src/openj9/runtime/vm/ContinuationHelpers.cpp:132
2989894 4177877224 0 0 999978 1397310592 0 0 2989894 4177877224 4096 3 /home/jenkins/workspace/build-scripts/jobs/jdk25/jdk25-linux-x64-openj9/workspace/build/src/openj9/runtime/vm/ContinuationHelpers.cpp:132
3099696 4331308544 0 0 109802 153431320 0 0 3099696 36341248 4096 3 /home/jenkins/workspace/build-scripts/jobs/jdk25/jdk25-linux-x64-openj9/workspace/build/src/openj9/runtime/vm/ContinuationHelpers.cpp:132
Ref https://github.ibm.com/runtimes/openj9-openjdk-jdk25-zos/issues/115