VisualVM shows artificial heap usage spikes during garbage collection

Aperta
#673 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
36/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
observability

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Java
Stelle
3.3k
Fork
337
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di oracle/visualvm

Tutte le issue di oracle/visualvm

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.