RFR: 8287135: Calculation of jmm_GetMemoryUsage is wrong [v4]

Thomas Stuefe stuefe at openjdk.org
Fri Jun 17 08:04:50 UTC 2022


On Fri, 17 Jun 2022 07:02:47 GMT, Yi Yang <yyang at openjdk.org> wrote:

>> It seems that calculation of MemoryMXBean.getNonHeapMemoryUsage(jmm_GetMemoryUsage) is wrong.
>> 
>> Currently, `NonHeapUsage=CodeCache+Metaspace(ClassTypeSpace+NonClassTypeSpace)+CompressedClassSpace(ClassTypeSpace)`
>> 
>> ==> CodeHeap 'non-nmethods' 1532544 (Used)
>> ==> CodeHeap 'profiled nmethods' 0
>> ==> CodeHeap 'non-profiled nmethods' 13952
>> ==> Metaspace 506696
>> ==> Compressed Class Space 43312
>> init = 7667712(7488K) used = 2096504(2047K) committed = 8454144(8256K) max = -1(-1K)
>> 
>> In this way, getNonHeapMemoryUsage is larger than it ought to be, it should be `NonHeapUsage = CodeCache + Metaspace`.
>
> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   address Ioi's comments; fix LowMemoryTest2.sh failure

Looks good, but see inline question.

test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.sh line 74:

> 72: #  we would have committed the space right away and therefore the MemoryMXBean "committed" trigger
> 73: #  would have fired. In the new Metaspace, we don't commit, so the MemoryMXBean does not fire.
> 74: go -noclassgc -XX:MaxMetaspaceSize=4m LowMemoryTest2

Why did you reduce the MaxMetaspaceSize? (Should probably be okay post JEP-387, but how does it relate to your change?)

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

PR: https://git.openjdk.org/jdk/pull/8831


More information about the serviceability-dev mailing list