VisualVM shows artificial heap usage spikes during garbage collection

Đang mở
#673 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
36/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
observability

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Java
Star
3.3k
Fork
337
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của oracle/visualvm

Tất cả issue của oracle/visualvm

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.