Class ClosureMagazine.Handle

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Handle​(ClosureMagazine magazine, long closureAddress, long codeAddress)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Releases the closure memory back to the operating system.
      void free()  
      long getAddress()
      Gets the native code address of the closure.
      void setAutoRelease​(boolean autorelease)
      Sets whether the closure memory should be released when the Handle is garbage collected or not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • closureAddress

        private final long closureAddress
      • codeAddress

        private final long codeAddress
    • Constructor Detail

      • Handle

        private Handle​(ClosureMagazine magazine,
                       long closureAddress,
                       long codeAddress)
    • Method Detail

      • getAddress

        public long getAddress()
        Description copied from interface: Closure.Handle
        Gets the native code address of the closure. This can be passed into a native function that takes a function pointer.
        Specified by:
        getAddress in interface Closure.Handle
        Returns:
        The native address of the closure code.
      • setAutoRelease

        public void setAutoRelease​(boolean autorelease)
        Description copied from interface: Closure.Handle
        Sets whether the closure memory should be released when the Handle is garbage collected or not.
        Specified by:
        setAutoRelease in interface Closure.Handle
        Parameters:
        autorelease - If true, the closure memory is automatically managed, else the closure memory must be explicitly freed.
      • dispose

        public void dispose()
        Description copied from interface: Closure.Handle
        Releases the closure memory back to the operating system. Although the closure trampoline memory will normally be released when the Handle is garbage collected, this may not happen for some time, and is non-deterministic. This allows explicit control over memory reclamation.
        Specified by:
        dispose in interface Closure.Handle