infinite.parallel().sequential().iterator() -> OOM

Dmitry Bessonov dmitry.bessonov at oracle.com
Thu Mar 21 09:13:43 PDT 2013


Hello,

I have checked this case with the latest build b82;
the problem is reproducible if one calls hasNext()/next()
on the iterator instance.

   Streams.generate(() -> 
"abc").parallel().sequential().iterator().hasNext();

-Dmitry

On 24.12.2012 21:31, Brian Goetz wrote:
> Yeah, same issue -- sequential() on a parallel stream is a full barrier.
>
> The right answer to this may well be to get rid of sequential(), which
> is being discussed in the EG.  We've found some ways to eliminate its
> primary motivation.
>
> On 12/24/2012 12:00 PM, Dmitry Bessonov wrote:
>> Hello,
>>
>> Here's an issue similar to the one reported recently. For example:
>>
>>     Streams.repeat("a").parallel().sequential().iterator();
>>
>> on b69 leads to something like
>>
>> Exception in thread "ForkJoinPool.commonPool-worker-7" Exception in
>> thread "ForkJoinPool.commonPool-worker-3" Exception in thread
>> "ForkJoinPool.commonPool-worker-1" Exception in thread
>> "ForkJoinPool.commonPool-worker-3" java.lang.OutOfMemoryError: Java heap
>> space
>> java.lang.OutOfMemoryError: Java heap space
>> java.lang.OutOfMemoryError: Java heap space
>>
>>
>> -Dmitry
>>



More information about the lambda-dev mailing list