-
Enhancement
-
Resolution: Fixed
-
P4
-
20
-
b11
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8317540 | 17.0.10 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
We need a fast counter for global mallocs for [JDK-8291878](https://bugs.openjdk.org/browse/JDK-8291878). NMT does not keep a global counter, just category-specific counters. At the moment, `MallocMemorySummary::total()` iterates all these counters and adds them up, which is quite costly.
This patch makes `MallocMemorySummary::total()` fast by introducing a global malloc counter. However, we don't add a new counter, we just repurpose the tracking overhead counter.
The tracking overhead counter gets updated on every malloc and counts number and size of all malloc headers. But malloc headers have always the same size. This patch uses the former overhead counter to count number and size of all mallocs. So now we have a global malloc counter, at no additional cost, and the overhead gets calculated from the number of total mallocs * constant header size.
This patch makes `MallocMemorySummary::total()` fast by introducing a global malloc counter. However, we don't add a new counter, we just repurpose the tracking overhead counter.
The tracking overhead counter gets updated on every malloc and counts number and size of all malloc headers. But malloc headers have always the same size. This patch uses the former overhead counter to count number and size of all mallocs. So now we have a global malloc counter, at no additional cost, and the overhead gets calculated from the number of total mallocs * constant header size.
- backported by
-
JDK-8317540 NMT: repurpose Tracking overhead counter as global malloc counter
- Resolved