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

Yi Yang yyang at openjdk.org
Tue Jun 21 02:44:53 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

> I would have thought that since we don't have the pool anymore, we can just remove this test line. The lines above already 
test against MaxMetaspaceSize.

Okay.

> I think you may be right, we need a replacement for the old memory bean for these tests. Whitebox seems easiest.

So should we keep tests as it is or add a new whitebox API and discard existing test changes? I prefer to keep tests as it is rather than adding whitebox API since I've made a lot of test changes. But I also want to hear your expert suggestions as final conclusion.

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

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


More information about the serviceability-dev mailing list