vtkDebugLeaks

Struct vtkDebugLeaks 

Source
pub struct vtkDebugLeaks(/* private fields */);
Expand description

identify memory leaks at program termination

vtkDebugLeaks is used to report memory leaks at the exit of the program. It uses vtkObjectBase::InitializeObjectBase() (called via vtkObjectFactory macros) to intercept the construction of all VTK objects. It uses the UnRegisterInternal method of vtkObjectBase to intercept the destruction of all objects.

If not using the vtkObjectFactory macros to implement New(), be sure to call vtkObjectBase::InitializeObjectBase() explicitly on the constructed instance. The rule of thumb is that wherever “new [some vtkObjectBase subclass]” is called, vtkObjectBase::InitializeObjectBase() must be called as well.

There are exceptions to this:

  • vtkCommand subclasses traditionally do not fully participate in vtkDebugLeaks registration, likely because they typically do not use vtkTypeMacro to configure GetClassName. InitializeObjectBase should not be called on vtkCommand subclasses, and all such classes will be automatically registered with vtkDebugLeaks as “vtkCommand or subclass”.

  • vtkInformationKey subclasses are not reference counted. They are allocated statically and registered automatically with a singleton “manager” instance. The manager ensures that all keys are cleaned up before exiting, and registration/deregistration with vtkDebugLeaks is bypassed.

A table of object name to number of instances is kept. At the exit of the program if there are still VTK objects around it will print them out. To enable this class add the flag -DVTK_DEBUG_LEAKS to the compile line, and rebuild vtkObject and vtkObjectFactory.

Implementations§

Source§

impl vtkDebugLeaks

Source

pub fn new() -> Self

Creates a new vtkDebugLeaks wrapped inside vtkNew

Trait Implementations§

Source§

impl Default for vtkDebugLeaks

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for vtkDebugLeaks

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.