From Gideon, support for tracking the number of objects constructed and deleted,
only compiled in when unit tests are compiled in.
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
|
||||
using namespace osg;
|
||||
|
||||
#ifdef OSG_COMPILE_UNIT_TESTS
|
||||
int Referenced::_createdCount = 0;
|
||||
int Referenced::_deletedCount = 0;
|
||||
#endif
|
||||
|
||||
Referenced::~Referenced()
|
||||
{
|
||||
if (_refCount>0)
|
||||
@@ -11,6 +16,9 @@ Referenced::~Referenced()
|
||||
notify(WARN)<<"Warning: deleting still referenced object "<<this<<" of type '"<<typeid(this).name()<<"'"<<std::endl;
|
||||
notify(WARN)<<" the final reference count was "<<_refCount<<", memory corruption possible."<<std::endl;
|
||||
}
|
||||
#ifdef OSG_COMPILE_UNIT_TESTS
|
||||
_deletedCount ++;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user