1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
package vtk;
/**
* This interface provide all the methods needed for the management of vtkObject
* in the Java world. They are used internally inside the generated Java code of
* the VTK objects to keep track of the reference count of the corresponding VTK
* C++ object and therefore allow to release memory when it became possible.
*
* Only the 3 following methods should be called by the user: - gc(boolean) : to
* run the garbage collection - getAutoGarbageCollector() : to get the EDT
* garbage collection scheduler - deleteAll() : to free any remaining VTK
* object.
*
* @author sebastien jourdain - sebastien.jourdain@kitware.com
*/
public interface vtkJavaMemoryManager {
/**
* Create or return an existing instance of the vtkObject that corresponds
* to the pointer id vtkId.
*
* @param vtkId
* is used to uniquely identify a vtkObject inside the C++ layer.
*
* @return a java object that map its underlying C++ instance.
*/
vtkObjectBase getJavaObject(Long vtkId);
/**
* Store the Java instance of a vtkObject inside a weak pointer map.
*
* @param id
* is used to uniquely identify a vtkObject inside the C++ layer.
* @param obj
* is the Java instance that is stored inside a WeakPointer of
* the map.
*/
void registerJavaObject(Long id, vtkObjectBase obj);
/**
* If found the Java object is removed from the map and we decrease the
* reference count of the underneath C++ instance.
*
* @param id
*/
void unRegisterJavaObject(Long id);
/**
* Execute the garbage collection in the Java + VTK context to release Java
* instance that are not used anymore which keep holding a C++ instance
* around.
*
* @param debug
* allow to add extra information inside the return object such
* as the class name of the objects lefts as well as their
* numbers.
*
* @return an information object that provide useful informations for
* statistic or debuging purpose.
*/
vtkReferenceInformation gc(boolean debug);
/**
* @return an helper class that allow to trigger the garbage collector at a
* given frequency inside the EDT.
*/
vtkJavaGarbageCollector getAutoGarbageCollector();
/**
* This method will clean up the Map of the Java objects and will release
* any vtkObject that was held by a Java one. This will prevent you from
* using any existing VTK Java object.
*
* @return the size of the map that we cleared
*/
int deleteAll();
/**
* @return the number of vtkObject that are currently used inside the Java
* world.
*/
int getSize();
/**
* @return the vtkReferenceInformation object generated by the last gc() call
*/
vtkReferenceInformation getLastReferenceInformation();
}
|