On Fri, 21 Jul 2023 22:40:00 GMT, Brian Burkhalter <b...@openjdk.org> wrote:
> Limit native memory allocation and move write loop from the native layer into > Java. This change should make the OOME reported in the issue much less likely. src/java.base/share/classes/java/io/FileOutputStream.java line 366: > 364: int n = writeBytes(b, off, len, append); > 365: if (n == -1) > 366: break; Checking if n is -1 doesn't look right here. Isn't return -1 just to keep the compiler happy when an exception is thrown. src/java.base/share/native/libjava/io_util.c line 62: > 60: /* The maximum size of a dynamically-allocated buffer. > 61: */ > 62: #define MAX_MALLOC_SIZE 2097152 How did you choose 2Mb, it seems high. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14981#discussion_r1272230776 PR Review Comment: https://git.openjdk.org/jdk/pull/14981#discussion_r1272250651