RFR: 8308252: Refactor line-by-line file reading code [v3]
Thomas Stuefe
stuefe at openjdk.org
Tue May 23 09:44:56 UTC 2023
On Thu, 18 May 2023 20:59:44 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> src/hotspot/share/utilities/lineReader.cpp line 76:
>>
>>> 74: if (new_length < _buffer_length) {
>>> 75: // This could happen on 32-bit. On 64-bit, the VM would have exited
>>> 76: // due to OOM before we ever get to here.
>>
>> This is scary. I don't like a general utility to use half my address space on 32-bit if bad things happen. I would cap the max. buffer size to something sensible, e.g. 1K or 64K.
>
> I'll add a max size with default to 1MB.
>
> Anyway, if you want to be scared, you should look at GrowableArray, which doubles itself with no upper limit checks. :-)
I'm easily scared :-)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14025#discussion_r1201875973
More information about the hotspot-dev
mailing list