Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8356372

JVMTI heap sampling not working properly with outside TLAB allocations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 25
    • hotspot
    • None

      While working on improving the TLAB sizing code for ZGC I ran into an issue with the following tests failing:
      serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorInterpreterObjectTest.java
      serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatObjectCorrectnessTest.java

      The reason for seeing the problems now is that with the new sizing code ZGC will use smaller TLAB at first, before resizing them to a proper size (to lower the waste). In the HeapMonitor tests we don't allocate enough to trigger GCs that will resize the TLABs so most of the tests will now run with small TLABs. This should not be a problem, but it turns out the current sampling code is not working properly when you get a lot of outside TLAB allocations. You get those when trying to allocate a fairly large object (~1400B) that won't fit into the TLAB, but there are still quite a bit of room in the TLAB so we don't want to throw it away and take a new one.

      The problem in the current code is that we keep track of when to sample with multiple variables and when getting out of TLAB allocations these get out of sync. Me and StefanK have been looking into the code and have ideas on how to improve the code structure (currently a mesh) and fix the issue.

            stefank Stefan Karlsson
            sjohanss Stefan Johansson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: