Class ClosureMagazine.Handle
java.lang.Object
com.kenai.jffi.ClosureMagazine.Handle
- All Implemented Interfaces:
Closure.Handle
- Enclosing class:
ClosureMagazine
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate final longprivate final ClosureMagazine -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateHandle(ClosureMagazine magazine, long closureAddress, long codeAddress) -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Releases the closure memory back to the operating system.voidfree()longGets the native code address of the closure.voidsetAutoRelease(boolean autorelease) Sets whether the closure memory should be released when theHandleis garbage collected or not.
-
Field Details
-
magazine
-
closureAddress
private final long closureAddress -
codeAddress
private final long codeAddress
-
-
Constructor Details
-
Handle
-
-
Method Details
-
getAddress
public long getAddress()Description copied from interface:Closure.HandleGets the native code address of the closure. This can be passed into a native function that takes a function pointer.- Specified by:
getAddressin interfaceClosure.Handle- Returns:
- The native address of the closure code.
-
setAutoRelease
public void setAutoRelease(boolean autorelease) Description copied from interface:Closure.HandleSets whether the closure memory should be released when theHandleis garbage collected or not.- Specified by:
setAutoReleasein interfaceClosure.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.HandleReleases the closure memory back to the operating system. Although the closure trampoline memory will normally be released when theHandleis garbage collected, this may not happen for some time, and is non-deterministic. This allows explicit control over memory reclamation.- Specified by:
disposein interfaceClosure.Handle
-
free
public void free()- Specified by:
freein interfaceClosure.Handle
-