RFR: 8324817: Parallel GC does not pre-touch all heap pages when AlwaysPreTouch enabled and large page disabled [v5]
Thomas Schatzl
tschatzl at openjdk.org
Thu Feb 1 13:53:17 UTC 2024
On Thu, 1 Feb 2024 11:37:19 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> Wang Zhuo has updated the pull request incrementally with one additional commit since the last revision:
>>
>> update test
>
> test/hotspot/jtreg/gc/parallel/TestAlwaysPreTouchBehavior.java line 69:
>
>> 67:
>> 68: String content = stringBuilder.toString();
>> 69: return Long.valueOf(content.split("\\s+")[1].trim());
>
> There does not need to be a reason to use the `StringBuilder` here. I also do not see a reason for the `deleteCharAt` call. Just use `line`.
>
> Suggestion:
>
> String line = null;
> while ((line = reader.readLine()) != null) {
> if (line.startsWith("VmRSS:")) {
> break;
> }
> }
> reader.close();
>
> return Long.valueOf(line.split("\\s+")[1].trim());
>
> If `line` is `null`, the NPE will be caught in the `catch` in the caller all the same.
Note that in case of an `IOException` the file will not be closed in either case. Maybe some `try-with-resources` is appropriate here when opening the `Reader`. I do not see this as critical as the test will be terminated soon enough anyway, freeing the file handle.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17610#discussion_r1474320686
More information about the hotspot-gc-dev
mailing list