Asylo
|
A closeable Java wrapper to hold a native object pointer. More...
Public Member Functions | |
void | close () |
This function hands over control to the child class by calling closeNative(long) for cleaning up the native resources and memory. More... | |
Protected Member Functions | |
AutoCloseablePointer (final long pointer) | |
final long | getPointer () |
abstract void | closeNative (final long pointer) |
Child classes should free up native resources and memory when this function is invoked. More... | |
A closeable Java wrapper to hold a native object pointer.
Child classes will map to the corresponding Asylo C++ classes. Objects of the child classes will also have memory allocated in the native heap. Java's garbage collector does not manage native memory, therefore, these objects must be explicitly closed.
Closing the objects of the inherited classes will denote that they are no longer needed and its native memory can be released. Inherited classes need to deallocate any resources, or memory allocated for the native objects when closeNative(long) is invoked. After closing an object, it is unsafe to use that object or call its APIs and it can lead to undefined behavior.
|
inlineprotected |
|
inline |
This function hands over control to the child class by calling closeNative(long) for cleaning up the native resources and memory.
After a successful call it resets the pointer to 0 and all future invocations of this function will be ignored.
|
abstractprotected |
Child classes should free up native resources and memory when this function is invoked.
pointer | Pointer value of the corresponding native object. |
|
inlineprotected |