On Mon, 13 Jan 2025 12:59:06 GMT, Viktor Klang <vkl...@openjdk.org> wrote:
> Backport to jdk24 of https://bugs.openjdk.org/browse/JDK-8347274 Does this fix the OOM problem? import java.util.stream.Gatherers; import java.util.stream.IntStream; /** * TODO: description of this file * * @author 虎鸣 */ public class Main { public static void main(String[] args) { final var stream = IntStream.range(0, Integer.MAX_VALUE); stream.boxed() .gather(Gatherers.mapConcurrent( 2, i -> { if (i == 0) { try { Thread.sleep(Integer.MAX_VALUE); } catch (InterruptedException e) { throw new RuntimeException(e); } } return i; })) .forEach(System.out::println); try { Thread.sleep(Integer.MAX_VALUE); } catch (InterruptedException e) { throw new RuntimeException(e); } } } ------------- PR Comment: https://git.openjdk.org/jdk/pull/23068#issuecomment-2587998277