VisualVM shows artificial heap usage spikes during garbage collection

Abierto
#673 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
36/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Java
Estrellas
3.3k
Forks
337
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de oracle/visualvm

Todos los issues de oracle/visualvm

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.