b69 regression: concat(parallel, infinite).sequential().iterator() -> OOM
Dmitry Bessonov
dmitry.bessonov at oracle.com
Wed Dec 19 03:10:24 PST 2012
Hello,
A regression has been noticed in b69.
The following code leads basically to OOM with b69.
--------------
import java.util.Arrays;
import java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.Streams;
public class ConcatParallelAndInfinite {
public static void main(String[] args) {
Stream<String> parallel = Arrays.asList("a", "b").parallelStream();
Stream<String> infinite = Streams.repeat("x");
Iterator<String> iterator = Streams.concat(parallel,
infinite).sequential().iterator();
System.out.println("iterator = " + iterator);
}
}
--------------
the output will be something like:
Exception in thread "ForkJoinPool.commonPool-worker-7" Exception in
thread "ForkJoinPool.commonPool-worker-7" Exception in thread
"ForkJoinPool.commonPool-worker-1" Exception in thread
"ForkJoinPool.commonPool-worker-11" Exception in thread
"ForkJoinPool.commonPool-worker-1" Exception in thread
"ForkJoinPool.commonPool-worker-9" Exception in thread
"ForkJoinPool.commonPool-worker-15" java.lang.OutOfMemoryError: Java
heap space
java.lang.OutOfMemoryError: Java heap space
Exception in thread "ForkJoinPool.commonPool-worker-13"
java.lang.OutOfMemoryError: Java heap space
Exception in thread "ForkJoinPool.commonPool-worker-11" Exception in
thread "ForkJoinPool.commonPool-worker-5"
With b68 code above works just fine
(assuming .parallelStream() renamed back to .parallel())
printing out the iterator instance.
-Dmitry
-------------- next part --------------
import java.util.Arrays;
import java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.Streams;
public class ConcatParallelAndInfinite {
public static void main(String[] args) {
Stream<String> parallel = Arrays.asList("a", "b").parallelStream();
Stream<String> infinite = Streams.repeat("x");
Iterator<String> iterator = Streams.concat(parallel, infinite).sequential().iterator();
System.out.println("iterator = " + iterator);
}
}
More information about the lambda-dev
mailing list