RFR: 8287135: Calculation of jmm_GetMemoryUsage is wrong
Yi Yang
yyang at openjdk.org
Fri Jun 17 07:02:49 UTC 2022
On Fri, 27 May 2022 07:22:11 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>>> I think the right fix is to just convert the MetaspacePool into NonClassMetaspacePool and only report the non-class values.
>>
>> Yes, it's okay for me. But I have another concern.
>>
>> The compressed class pool is not directly used by other VM components. However, memory pools are exposed via java management APIs. At JDK level, users could obtain memory pools and choose a specified pool by name. If adapting the first solution, I guess it's somewhat strange for users to understand what is `Non Class Space`:
>>
>> private static MemoryPoolMXBean getMemoryPool(String name) {
>> List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
>> for (MemoryPoolMXBean pool : pools) {
>> if (pool.getName().equals(name)) {
>> return pool;
>> }
>> }
>>
>> throw new RuntimeException("Expected to find a memory pool with name " + name);
>> }
>> public static void foo() {
>> MemoryPoolMXBean a = getMemoryPool("Compressed Class Space");
>> MemoryPoolMXBean a = getMemoryPool("Non Class Space");
>> }
>>
>> If we remove `CompressedClassSpace`, we can only `getMemoryPool("Metaspace")`. Although metaspace is not baked in the specification, IMHO it's easier for developers to understand what is `metaspace` compared to the concepts of `Non Class Space` and `Compressed Class Space`.
>
>>
>> If we remove `CompressedClassSpace`, we can only `getMemoryPool("Metaspace")`. Although metaspace is not baked in the specification, IMHO it's easier for developers to understand what is `metaspace` compared to the concepts of `Non Class Space` and `Compressed Class Space`.
>
> I personally think that would be totally fine.
@tstuefe Can you please take a look at test changes? Thanks!
-------------
PR: https://git.openjdk.org/jdk/pull/8831
More information about the serviceability-dev
mailing list