VisualVM shows artificial heap usage spikes during garbage collection

オープン
#673 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
36/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java
領域
observability

調査の方向性

VisualVM draws heap usage from the JVM's JMX memory and garbage-collector MXBeans, so start by finding the polling code behind the heap graph (the sampler/monitor module that queries java.lang:type=Memory and the ZGC collector bean) and compare what it reads with jcmd <PID> GC.heap_info. Confirm whether the mismatch comes from using committed/max values or from ZGC only publishing used after a collection, then reproduce against a ZGC JVM. Done means the graph's used value matches ZHeap used both before and after a GC.

索引モデルが issue の本文から書いたものです。

説明

bug

Describe the bug

Heap size as reported by jcmd <PID> GC.heap_info:

Before GC:

ZHeap            used 12330M, capacity 29184M, max capacity 29184M
 Cache           16854M (1)
  size classes   16G (1)

After GC:

ZHeap            used 848M, capacity 29184M, max capacity 29184M
 Cache           28336M (99)
  size classes   2M (37), 4M (26), 8M (12), 16M (6), 32M (8), 64M (1), 128M (3), 256M (1), 512M (1), 2G (3), 16G (1)

VisualVM:

Bildschirmfoto vom 2026-11-23 16-45-07

Notice that VisualVM and the output of jcmd only seem to match after a GC is triggered. The reported value before the GC doesn't match the one reported as used ZHeap.

Expected behavior
VisualVM should display the same usage values as the reported ZHeap value. Currently this seems to only be the case after a GC run.

Desktop (please complete the following information):

  • OS: Ubuntu 26.04
  • JDK version 25.0.5.1
  • Version 2.2.1
主要言語
Java
スター
3.3k
フォーク
337
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

oracle/visualvm のほかの issue

oracle/visualvm の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。