ActiViz .NET  5.8.0
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Private Member Functions | Static Private Member Functions
Kitware.VTK.vtkGarbageCollector Class Reference

vtkGarbageCollector - Detect and break reference loops More...

Inheritance diagram for Kitware.VTK.vtkGarbageCollector:
[legend]
Collaboration diagram for Kitware.VTK.vtkGarbageCollector:
[legend]

List of all members.

Public Member Functions

 vtkGarbageCollector (IntPtr rawCppThis, bool callDisposalMethod, bool strong)
 Automatically generated constructor - called from generated code. DO NOT call directly.
 vtkGarbageCollector ()
 Undocumented Block.
override int IsA (string type)
 Undocumented Block.
new vtkGarbageCollector NewInstance ()
 Undocumented Block.

Static Public Member Functions

static new vtkGarbageCollector New ()
 Undocumented Block.
static void Collect ()
 Collect immediately using any objects whose collection was previously deferred as a root for the reference graph walk. Strongly connected components in the reference graph are identified. Those with a net reference count of zero are deleted. When a component is deleted it may remove references to other components that are not part of the same reference loop but are held by objects in the original component. These removed references are handled as any other and their corresponding checks may be deferred. This method keeps collecting until no deferred collection checks remain.
static void Collect (vtkObjectBase root)
 Collect immediately using the given object as the root for a reference graph walk. Strongly connected components in the reference graph are identified. Those with a net reference count of zero are deleted. When a component is deleted it may remove references to other components that are not part of the same reference loop but are held by objects in the original component. These removed references are handled as any other and their corresponding checks may be deferred. This method does continue collecting in this case.
static void DeferredCollectionPop ()
 Push/Pop whether to do deferred collection. Whenever the total number of pushes exceeds the total number of pops collection will be deferred. Code can call the Collect method directly to force collection.
static void DeferredCollectionPush ()
 Push/Pop whether to do deferred collection. Whenever the total number of pushes exceeds the total number of pops collection will be deferred. Code can call the Collect method directly to force collection.
static int GetGlobalDebugFlag ()
 Set/Get global garbage collection debugging flag. When set to 1, all garbage collection checks will produce debugging information.
static new int IsTypeOf (string type)
 Undocumented Block.
static new vtkGarbageCollector SafeDownCast (vtkObjectBase o)
 Undocumented Block.
static void SetGlobalDebugFlag (int flag)
 Set/Get global garbage collection debugging flag. When set to 1, all garbage collection checks will produce debugging information.

Public Attributes

new const string MRFullTypeName = "Kitware.VTK.vtkGarbageCollector"
 Automatically generated type registration mechanics.

Static Public Attributes

static new readonly string MRClassNameKey = "19vtkGarbageCollector"
 Automatically generated type registration mechanics.

Protected Member Functions

override void Dispose (bool disposing)
 Automatically generated protected Dispose method - called from public Dispose or the C# destructor. DO NOT call directly.

Private Member Functions

static internal IntPtr vtkGarbageCollector_New (ref uint mteStatus, ref uint mteIndex, ref uint rawRefCount)
static internal void vtkGarbageCollector_Collect_01 ()
static internal void vtkGarbageCollector_Collect_02 (HandleRef root)
static internal void vtkGarbageCollector_DeferredCollectionPop_03 ()
static internal void vtkGarbageCollector_DeferredCollectionPush_04 ()
static internal int vtkGarbageCollector_GetGlobalDebugFlag_05 ()
static internal int vtkGarbageCollector_IsA_06 (HandleRef pThis, string type)
static internal int vtkGarbageCollector_IsTypeOf_07 (string type)
static internal IntPtr vtkGarbageCollector_NewInstance_09 (HandleRef pThis, ref uint mteStatus, ref uint mteIndex, ref uint rawRefCount)
static internal IntPtr vtkGarbageCollector_SafeDownCast_10 (HandleRef o, ref uint mteStatus, ref uint mteIndex, ref uint rawRefCount)
static internal void vtkGarbageCollector_SetGlobalDebugFlag_11 (int flag)

Static Private Member Functions

static vtkGarbageCollector ()
 Automatically generated type registration mechanics.

Detailed Description

vtkGarbageCollector - Detect and break reference loops

Description vtkGarbageCollector is used by VTK classes that may be involved in reference counting loops (such as Algorithm <-> Executive). It detects strongly connected components of the reference graph that have been leaked deletes them. The garbage collector uses the ReportReferences method to search the reference graph and construct a net reference count for each connected component. If the net reference count is zero the entire set of objects is deleted. Deleting each component may leak other components, which are then collected recursively.

To enable garbage collection for a class, add these members:

     public:
      virtual void Register(vtkObjectBase* o)
        {
        this-&gt;RegisterInternal(o, 1);
        }
      virtual void UnRegister(vtkObjectBase* o)
        {
        this-&gt;UnRegisterInternal(o, 1);
        }

     protected:

      virtual void ReportReferences(vtkGarbageCollector* collector)
        {
        // Report references held by this object that may be in a loop.
        this-&gt;Superclass::ReportReferences(collector);
        vtkGarbageCollectorReport(collector, this-&gt;OtherObject, &quot;Other Object&quot;);
        }

The implementations should be in the .cxx file in practice. It is important that the reference be reported using the real pointer or smart pointer instance that holds the reference. When collecting the garbage collector will actually set this pointer to NULL. The destructor of the class should be written to deal with this. It is also expected that an invariant is maintained for any reference that is reported. The variable holding the reference must always either be NULL or refer to a fully constructed valid object. Therefore code like "this->Object->UnRegister(this)" must be avoided if "this->Object" is a reported reference because it is possible that the object is deleted before UnRegister returns but then "this->Object" will be left as a dangling pointer. Instead use code like

      vtkObjectBase* obj = this-&gt;Object;
      this-&gt;Object = 0;
      obj-&gt;UnRegister(this);

so that the reported reference maintains the invariant.

If subclassing from a class that already supports garbage collection, one need only provide the ReportReferences method.


Constructor & Destructor Documentation

Automatically generated type registration mechanics.

Kitware.VTK.vtkGarbageCollector.vtkGarbageCollector ( IntPtr  rawCppThis,
bool  callDisposalMethod,
bool  strong 
)

Automatically generated constructor - called from generated code. DO NOT call directly.

Undocumented Block.


Member Function Documentation

static void Kitware.VTK.vtkGarbageCollector.Collect ( ) [static]

Collect immediately using any objects whose collection was previously deferred as a root for the reference graph walk. Strongly connected components in the reference graph are identified. Those with a net reference count of zero are deleted. When a component is deleted it may remove references to other components that are not part of the same reference loop but are held by objects in the original component. These removed references are handled as any other and their corresponding checks may be deferred. This method keeps collecting until no deferred collection checks remain.

Collect immediately using the given object as the root for a reference graph walk. Strongly connected components in the reference graph are identified. Those with a net reference count of zero are deleted. When a component is deleted it may remove references to other components that are not part of the same reference loop but are held by objects in the original component. These removed references are handled as any other and their corresponding checks may be deferred. This method does continue collecting in this case.

Push/Pop whether to do deferred collection. Whenever the total number of pushes exceeds the total number of pops collection will be deferred. Code can call the Collect method directly to force collection.

Push/Pop whether to do deferred collection. Whenever the total number of pushes exceeds the total number of pops collection will be deferred. Code can call the Collect method directly to force collection.

override void Kitware.VTK.vtkGarbageCollector.Dispose ( bool  disposing) [protected]

Automatically generated protected Dispose method - called from public Dispose or the C# destructor. DO NOT call directly.

Reimplemented from Kitware.VTK.vtkObject.

Set/Get global garbage collection debugging flag. When set to 1, all garbage collection checks will produce debugging information.

override int Kitware.VTK.vtkGarbageCollector.IsA ( string  type) [virtual]

Undocumented Block.

Reimplemented from Kitware.VTK.vtkObject.

static new int Kitware.VTK.vtkGarbageCollector.IsTypeOf ( string  type) [static]

Undocumented Block.

Reimplemented from Kitware.VTK.vtkObject.

Undocumented Block.

Reimplemented from Kitware.VTK.vtkObject.

Undocumented Block.

Reimplemented from Kitware.VTK.vtkObject.

Undocumented Block.

Reimplemented from Kitware.VTK.vtkObject.

Here is the call graph for this function:

static void Kitware.VTK.vtkGarbageCollector.SetGlobalDebugFlag ( int  flag) [static]

Set/Get global garbage collection debugging flag. When set to 1, all garbage collection checks will produce debugging information.

static internal void Kitware.VTK.vtkGarbageCollector.vtkGarbageCollector_Collect_02 ( HandleRef  root) [private]
static internal int Kitware.VTK.vtkGarbageCollector.vtkGarbageCollector_IsA_06 ( HandleRef  pThis,
string  type 
) [private]
static internal int Kitware.VTK.vtkGarbageCollector.vtkGarbageCollector_IsTypeOf_07 ( string  type) [private]
static internal IntPtr Kitware.VTK.vtkGarbageCollector.vtkGarbageCollector_New ( ref uint  mteStatus,
ref uint  mteIndex,
ref uint  rawRefCount 
) [private]
static internal IntPtr Kitware.VTK.vtkGarbageCollector.vtkGarbageCollector_NewInstance_09 ( HandleRef  pThis,
ref uint  mteStatus,
ref uint  mteIndex,
ref uint  rawRefCount 
) [private]
static internal IntPtr Kitware.VTK.vtkGarbageCollector.vtkGarbageCollector_SafeDownCast_10 ( HandleRef  o,
ref uint  mteStatus,
ref uint  mteIndex,
ref uint  rawRefCount 
) [private]

Member Data Documentation

new readonly string Kitware.VTK.vtkGarbageCollector.MRClassNameKey = "19vtkGarbageCollector" [static]

Automatically generated type registration mechanics.

Reimplemented from Kitware.VTK.vtkObject.

new const string Kitware.VTK.vtkGarbageCollector.MRFullTypeName = "Kitware.VTK.vtkGarbageCollector"

Automatically generated type registration mechanics.

Reimplemented from Kitware.VTK.vtkObject.


The documentation for this class was generated from the following file: