4 * This interface provide all the methods needed for the management of vtkObject
5 * in the Java world. They are used internally inside the generated Java code of
6 * the VTK objects to keep track of the reference count of the corresponding VTK
7 * C++ object and therefore allow to release memory when it became possible.
9 * Only the 3 following methods should be called by the user: - gc(boolean) : to
10 * run the garbage collection - getAutoGarbageCollector() : to get the EDT
11 * garbage collection scheduler - deleteAll() : to free any remaining VTK
14 * @author sebastien jourdain - sebastien.jourdain@kitware.com
16 public interface vtkJavaMemoryManager {
18 * Create or return an existing instance of the vtkObject that corresponds
19 * to the pointer id vtkId.
22 * is used to uniquely identify a vtkObject inside the C++ layer.
24 * @return a java object that map its underlying C++ instance.
26 vtkObjectBase getJavaObject(Long vtkId);
29 * Store the Java instance of a vtkObject inside a weak pointer map.
32 * is used to uniquely identify a vtkObject inside the C++ layer.
34 * is the Java instance that is stored inside a WeakPointer of
37 void registerJavaObject(Long id, vtkObjectBase obj);
40 * If found the Java object is removed from the map and we decrease the
41 * reference count of the underneath C++ instance.
45 void unRegisterJavaObject(Long id);
48 * Execute the garbage collection in the Java + VTK context to release Java
49 * instance that are not used anymore which keep holding a C++ instance
53 * allow to add extra information inside the return object such
54 * as the class name of the objects lefts as well as their
57 * @return an information object that provide useful information for
58 * statistic or debugging purpose.
60 vtkReferenceInformation gc(boolean debug);
63 * @return an helper class that allow to trigger the garbage collector at a
64 * given frequency inside the EDT.
66 vtkJavaGarbageCollector getAutoGarbageCollector();
69 * This method will clean up the Map of the Java objects and will release
70 * any vtkObject that was held by a Java one. This will prevent you from
71 * using any existing VTK Java object.
73 * @return the size of the map that we cleared
78 * @return the number of vtkObject that are currently used inside the Java
84 * @return the vtkReferenceInformation object generated by the last gc() call
86 vtkReferenceInformation getLastReferenceInformation();