Class NativeObject

java.lang.Object
org.graalvm.nativebridge.NativeObject

public class NativeObject extends Object
Encapsulates a handle to an object in a native image heap where the object's lifetime is bound to the lifetime of the NativeObject instance. At some point, after a NativeObject is garbage collected, a call is made to release the handle, allowing the corresponding object in the native image heap to be collected.
  • Constructor Details

    • NativeObject

      public NativeObject(NativeIsolate isolate, long objectHandle)
      Creates a new NativeObject.
      Parameters:
      isolate - an isolate in which an object referenced by the handle exists.
      objectHandle - a handle to an object in a native image heap
  • Method Details

    • getIsolate

      public final NativeIsolate getIsolate()
      Returns an isolate in which an object referenced by this handle exists.
    • getHandle

      public final long getHandle()
      Returns a handle to an object in the native image heap.
    • release

      public final void release()
      Explicitly releases object in the native image heap referenced by this handle. The use of this method should be exceptional. By default, the lifetime of the object in the native image heap is bound to the lifetime of the NativeObject instance.