RFR: 8353479: jcmd with streaming output breaks intendation

Alex Menkov amenkov at openjdk.org
Tue Apr 1 21:32:35 UTC 2025


On Tue, 1 Apr 2025 21:23:01 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> `outputStream` implementations should call `update_position` from `write` to correctly handle indentation.
> The fix adds the call to `attachStream::write`
> 
> testing: sanity tier1;
>    in progress: tier2..4,hs-tier5-svc

Example of output with and without streaming output:


$ JAVA_TOOL_OPTIONS=-Djdk.attach.allowStreamingOutput=true jcmd 31544 VM.native_memory
Picked up JAVA_TOOL_OPTIONS: -Djdk.attach.allowStreamingOutput=true
31544:

Native Memory Tracking:

(Omitting categories weighting less than 1KB)

Total: reserved=9953148KB, committed=407888KB
       malloc: 57776KB #293244, peak=75433KB #212390
       mmap:          reserved=9895372KB, committed=350112KB

-                 Java Heap (reserved=8298496KB, committed=270336KB)
                            (mmap: reserved=8298496KB, committed=270336KB,                             peak=520192KB)

-                     Class (reserved=1048938KB, committed=2922KB)
                            (classes #3716)
                            (  instance classes #3406, array classes #310)
                            (malloc=362KB                             #7060                            )                             (peak=364KB #7068)
                            (mmap: reserved=1048576KB, committed=2560KB,                             at peak)
                            (  Metadata:   )
                            (                                reserved=65536KB, committed=24384KB                            )
                            (    used=24223KB)
                            (    waste=161KB =0.66%)
                            (  Class space:)
                            (                                reserved=1048576KB, committed=2560KB                            )
                            (    used=2423KB)
                            (    waste=137KB =5.36%)




$ jcmd 31544 VM.native_memory
31544:

Native Memory Tracking:

(Omitting categories weighting less than 1KB)

Total: reserved=9953152KB, committed=407892KB
       malloc: 57780KB #293282, peak=75433KB #212390
       mmap:   reserved=9895372KB, committed=350112KB

-                 Java Heap (reserved=8298496KB, committed=270336KB)
                            (mmap: reserved=8298496KB, committed=270336KB, peak=520192KB)

-                     Class (reserved=1048938KB, committed=2922KB)
                            (classes #3716)
                            (  instance classes #3406, array classes #310)
                            (malloc=362KB #7060) (peak=364KB #7068)
                            (mmap: reserved=1048576KB, committed=2560KB, at peak)
                            (  Metadata:   )
                            (    reserved=65536KB, committed=24384KB)
                            (    used=24223KB)
                            (    waste=161KB =0.66%)
                            (  Class space:)
                            (    reserved=1048576KB, committed=2560KB)
                            (    used=2423KB)
                            (    waste=137KB =5.36%)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/24368#issuecomment-2770724520


More information about the hotspot-runtime-dev mailing list