Class HeapDump.ArrayBuilder

java.lang.Object
org.graalvm.tools.insight.heap.HeapDump.ArrayBuilder
Enclosing class:
HeapDump

public final class HeapDump.ArrayBuilder extends Object
Fills data for new array to put into the HeapDump.
Since:
21.3.2
See Also:
  • Method Details

    • put

      public HeapDump.ArrayBuilder put(int index, HeapDump.ObjectInstance value)
      Puts reference to another object into the array.
      Parameters:
      index - zero based index into the array
      value - reference to object in the HeapDump
      Returns:
      this builder
      Since:
      21.3.2
    • dumpInstance

      public HeapDump.ObjectInstance dumpInstance() throws UncheckedIOException
      Dumps the gathered array values into the HeapDump.
      Returns:
      object representing the written instance
      Throws:
      UncheckedIOException - when an I/O error occurs
      Since:
      21.3.2
      See Also:
    • id

      The ID assigned to the instance. Allows one to obtain ID of an instance before it is dumped into the HeapDump.

      HeapDump.InstanceBuilder mainBuilder = heap.newInstance(classMain);
      final ObjectInstance main = mainBuilder.id();
      mainBuilder.put("tom", tom).put("jerry", jerry);
      
      ObjectInstance cathingThread = heap.newThread("Catching Jerry").
          addStackFrame(classActor, "tom", "Actor.java", -1, jerry, tom, main).
          addStackFrame(classMain, "main", "Main.java", -1, main).
          dumpThread();
      
      mainBuilder.put("thread", cathingThread).dumpInstance();
      
      Returns:
      object reference for the instance that's going to be built when dumpInstance() method is invoked
      Since:
      21.3.2