Class VMRuntime

java.lang.Object
org.graalvm.nativeimage.VMRuntime

public final class VMRuntime extends Object
Used for doing VM runtime operations.
Since:
19.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    dumpHeap(String outputFile, boolean live)
    Dumps the heap to the outputFile file in the same format as the hprof heap dump.
    static void
    Initializes the VM: Runs all startup hooks that were registered during image building.
    static void
    Shuts down the VM: Runs all shutdown hooks and waits for all finalization to complete.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • initialize

      public static void initialize()
      Initializes the VM: Runs all startup hooks that were registered during image building. Startup hooks usually depend on option values, so it is recommended (but not required) that all option values are set before calling this method.

      Invoking this method more than once has no effect, i.e., startup hooks are only executed at the first invocation.

      Since:
      19.0
    • shutdown

      public static void shutdown()
      Shuts down the VM: Runs all shutdown hooks and waits for all finalization to complete.

      This method should only be called once. Invoking this method multiple times can have continued effects. Also, although recommended, it is not strictly required for initialize() to be called before this method.

      Since:
      19.0
    • dumpHeap

      public static void dumpHeap(String outputFile, boolean live) throws IOException
      Dumps the heap to the outputFile file in the same format as the hprof heap dump.
      Throws:
      UnsupportedOperationException - if this operation is not supported.
      IOException
      Since:
      20.1