RFR: 8287135: Calculation of jmm_GetMemoryUsage is wrong
David Holmes
dholmes at openjdk.java.net
Thu May 26 07:38:43 UTC 2022
On Thu, 26 May 2022 05:59:30 GMT, Yi Yang <yyang at openjdk.org> wrote:
>> src/hotspot/share/services/management.cpp line 753:
>>
>>> 751: for (int i = 0; i < MemoryService::num_memory_pools(); i++) {
>>> 752: MemoryPool* pool = MemoryService::get_memory_pool(i);
>>> 753: if (pool->is_codeheap() || pool->is_metaspace()) {
>>
>> Our only special case is that all the memory reported by `CompressedKlassSpacePool` are already reported by `MetaspacePool`, so shouldn't we do this:
>>
>>
>> if (pool->is_non_heap() && !pool->is_compressed_klass_space()) {
>> // skip CompressedKlassSpacePool since its memory is already reported by
>> // MetaspacePool
>
> This is also acceptable, but if we add more memory pools, we might add more special pools to exclude their space from nonheap. Instead, we can specify exactly which pools we need to accumulate, which is what this change did.
I think the problem is the definition of the pools. We seem to have nested pools but it is far from clear that this API/mechanism was designed/intended to support nested pools.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8831
More information about the serviceability-dev
mailing list