RFR: 8298992: runtime/NMT/SummarySanityCheck.java failed with "Total commi…tted (MMMMMM) did not match the summarized committed (NNNNNN)
Gerard Ziemski
gziemski at openjdk.org
Tue Aug 22 19:58:18 UTC 2023
On Tue, 22 Aug 2023 15:56:08 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> We copy `MemoryCounter` by value, not reference:
>>
>> `s->_all_mallocs = _all_mallocs;`
>>
>> where `_all_mallocs` is `MemoryCounter`, not `*MemoryCounter`, so that assert can never trigger, right?
>>
>> I mean, even if more memory gets allocated between when we exit the loop and assert, `_all_mallocs.size()` might change, but `s->_all_mallocs.size()` is frozen in time, isn't it?
>>
>> So I agree that the assert is not helpful here, but it's because it will never trigger.
>
> I thought the point was to compare the accumulated sum with the running total kept in _all_mallocs?
My understanding is that we make a snapshot of 2 moving parts: `_all_mallocs` and `_malloc[nmt_type]`
The problem is that after we snapshot `_all_mallocs`, `_malloc[nmt_type]` can change, so that:
`s._all_mallocs.size() != s._malloc[nmt_type1] + s._malloc[nmt_type2] + ...`
so we keep trying in a loop until we catch the system in a quiet enough period where:
`s._all_mallocs.size() == s._malloc[nmt_type1] + s._malloc[nmt_type2] + ...`
so when we come out of the loop then the **assert** is guaranteed never to trigger, because we made copies that are not going to change.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15306#discussion_r1302105398
More information about the hotspot-runtime-dev
mailing list