RFR: JDK-8318636: Add jcmd to print annotated process memory map [v6]
Thomas Stuefe
stuefe at openjdk.org
Wed Nov 1 06:09:04 UTC 2023
On Mon, 30 Oct 2023 17:31:30 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
>> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fix various builds
>
> src/hotspot/os/linux/memMapPrinter_linux.cpp line 83:
>
>> 81: char line[linesize];
>> 82: while(fgets(line, sizeof(line), f) == line) {
>> 83: line[sizeof(line) - 1] = '\0';
>
> What would happen if the read line is empty, i.e. sizeof(line)==0, can that happen?
sizeof(line) is the size of the character array, not strlen. It is linesize bytes. `x[sizeof(x) - 1] = '\0';` is the typical pattern one uses to ensure a character array is zero-terminated.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16301#discussion_r1378425890
More information about the serviceability-dev
mailing list