VTK
dox
Common
Core
vtkDebugLeaks.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkDebugLeaks.h
5
6
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7
All rights reserved.
8
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10
This software is distributed WITHOUT ANY WARRANTY; without even
11
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
PURPOSE. See the above copyright notice for more information.
13
14
=========================================================================*/
49
#ifndef vtkDebugLeaks_h
50
#define vtkDebugLeaks_h
51
52
#include "vtkCommonCoreModule.h"
// For export macro
53
#include "
vtkObject.h
"
54
55
#include "vtkToolkits.h"
// Needed for VTK_DEBUG_LEAKS macro setting.
56
#include "
vtkDebugLeaksManager.h
"
// Needed for proper singleton initialization
57
58
class
vtkDebugLeaksHashTable;
59
class
vtkSimpleCriticalSection
;
60
class
vtkDebugLeaksObserver
;
61
62
class
VTKCOMMONCORE_EXPORT
vtkDebugLeaks
:
public
vtkObject
63
{
64
public
:
65
static
vtkDebugLeaks
*
New
();
66
vtkTypeMacro(
vtkDebugLeaks
,
vtkObject
);
67
71
static
void
ConstructClass(
const
char
* classname);
72
76
static
void
DestructClass(
const
char
* classname);
77
82
static
int
PrintCurrentLeaks();
83
85
89
static
int
GetExitError();
90
static
void
SetExitError(
int
);
92
93
static
void
SetDebugLeaksObserver(
vtkDebugLeaksObserver
* observer);
94
static
vtkDebugLeaksObserver
* GetDebugLeaksObserver();
95
96
protected
:
97
vtkDebugLeaks
(){}
98
~vtkDebugLeaks
()
override
{}
99
100
static
int
DisplayMessageBox(
const
char
*);
101
102
static
void
ClassInitialize();
103
static
void
ClassFinalize();
104
105
static
void
ConstructingObject(
vtkObjectBase
*
object
);
106
static
void
DestructingObject(
vtkObjectBase
*
object
);
107
108
friend
class
vtkDebugLeaksManager
;
109
friend
class
vtkObjectBase
;
110
111
private
:
112
static
vtkDebugLeaksHashTable* MemoryTable;
113
static
vtkSimpleCriticalSection
* CriticalSection;
114
static
vtkDebugLeaksObserver
* Observer;
115
static
int
ExitError;
116
117
vtkDebugLeaks
(
const
vtkDebugLeaks
&) =
delete
;
118
void
operator=
(
const
vtkDebugLeaks
&) =
delete
;
119
};
120
121
// This class defines callbacks for debugging tools. The callbacks are not for general use.
122
// The objects passed as arguments to the callbacks are in partially constructed or destructed
123
// state and accessing them may cause undefined behavior.
124
class
VTKCOMMONCORE_EXPORT
vtkDebugLeaksObserver
{
125
public
:
126
virtual
~vtkDebugLeaksObserver
() {}
127
virtual
void
ConstructingObject(
vtkObjectBase
*) = 0;
128
virtual
void
DestructingObject(
vtkObjectBase
*) = 0;
129
};
130
131
#endif // vtkDebugLeaks_h
132
// VTK-HeaderTest-Exclude: vtkDebugLeaks.h
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
Definition:
vtkObjectBase.h:226
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition:
vtkObject.h:59
vtkDebugLeaksManager.h
vtkDebugLeaks::vtkDebugLeaks
vtkDebugLeaks()
Definition:
vtkDebugLeaks.h:97
vtkObjectBase
abstract base class for most VTK objects
Definition:
vtkObjectBase.h:65
vtkSimpleCriticalSection
Critical section locking class.
Definition:
vtkSimpleCriticalSection.h:59
vtkDebugLeaksObserver::~vtkDebugLeaksObserver
virtual ~vtkDebugLeaksObserver()
Definition:
vtkDebugLeaks.h:126
vtkObject.h
vtkDebugLeaks
identify memory leaks at program termination vtkDebugLeaks is used to report memory leaks at the exit...
Definition:
vtkDebugLeaks.h:62
vtkDebugLeaksManager
Manages the vtkDebugLeaks singleton.
Definition:
vtkDebugLeaksManager.h:31
vtkDebugLeaksObserver
Definition:
vtkDebugLeaks.h:124
vtkDebugLeaks::~vtkDebugLeaks
~vtkDebugLeaks() override
Definition:
vtkDebugLeaks.h:98
Generated by
1.8.16