RFR: JDK-8298298: NMT: count deltas are printed with 32-bit signed size [v2]

Thomas Stuefe stuefe at openjdk.org
Thu Dec 8 08:56:17 UTC 2022


> Deltas for counts in NMT differential reports are shown as signed int, restricting them to +-2g. These counts are number of malloc blocks, or number of classes, or number of threads. In all cases number of physically existing somethings.
> 
> On large 64-bit machines they can conceivably overflow. Well, at least the malloc block counters. Granted, mallocing even just >2g number of 1 byte blocks costs about 40-50GB due to overhead in libc and NMT (on glibc). But it is conceivable.
> 
> Patch changes delta printing from int to ssize_t.
> 
> Note that I don't worry about overflowing SSIZE_MIN or SSIZE_MAX here. That would be ridiculous: we just cannot have that many physically existing things. Not on 64bit, not even on 32-bit where ssize_t is int, since in both cases the address space would be the limit. So, if the counters are that large, we have a different problem (probably counter overflow), and so we assert, resp. in release, ignore it.
> 
> Note we have the same problem with diff sizes. I expect [8281213](https://bugs.openjdk.org/browse/JDK-8281213) to fix that.

Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Factor out delta-ing and assert ranges
 - Merge branch 'master' into JDK-8298298-nmt-count-deltas-32-bit
 - JDK-8298298-nmt-count-deltas-32-bit

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11568/files
  - new: https://git.openjdk.org/jdk/pull/11568/files/a92ff83d..22a577f2

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11568&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11568&range=00-01

  Stats: 6052 lines in 110 files changed: 4114 ins; 1510 del; 428 mod
  Patch: https://git.openjdk.org/jdk/pull/11568.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11568/head:pull/11568

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


More information about the hotspot-dev mailing list