RFR: 6478546: FileInputStream.read() throws OutOfMemoryError when there is plenty available [v2]
Vyom Tewari
vtewari at openjdk.org
Wed Jul 26 06:19:54 UTC 2023
On Tue, 25 Jul 2023 23:50:07 GMT, Brian Burkhalter <bpb at 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.
>
> Brian Burkhalter has updated the pull request incrementally with three additional commits since the last revision:
>
> - 6478546: Decrease malloc limit to 1.5 MB
> - 6478546: Minor refactoring
> - 6478546: Prevent short read
src/java.base/share/classes/java/io/FileInputStream.java line 266:
> 264: } catch (IOException e) {
> 265: // Throw only if no bytes have been read
> 266: if (off == start)
If i am reading code correctly then with the new implementation, until client issue the next "FIS.read" he may or may not know if there was exception pending in previous 'read' call ?.
I am not sure in case of partial read we have suppress the exception.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14981#discussion_r1274424360
More information about the core-libs-dev
mailing list