From 27f2f87e299e46ae11a6c3ceb93d7dd962685b1f Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 29 Sep 2017 15:30:50 -0500 Subject: [PATCH] reftrack class Field --- src/factory/FieldCreateFactory.cpp | 11 ++++++++++- src/pv/pvIntrospect.h | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/factory/FieldCreateFactory.cpp b/src/factory/FieldCreateFactory.cpp index a3c9133..6742758 100644 --- a/src/factory/FieldCreateFactory.cpp +++ b/src/factory/FieldCreateFactory.cpp @@ -21,6 +21,7 @@ #include #define epicsExportSharedSymbols +#include #include #include #include @@ -34,12 +35,17 @@ namespace epics { namespace pvData { static DebugLevel debugLevel = lowDebug; +size_t Field::num_instances; + + Field::Field(Type type) : m_fieldType(type) { + REFTRACE_INCREMENT(num_instances); } Field::~Field() { + REFTRACE_DECREMENT(num_instances); } @@ -1419,7 +1425,10 @@ FieldCreatePtr FieldCreate::getFieldCreate() static Mutex mutex; Lock xx(mutex); - if(fieldCreate.get()==0) fieldCreate = FieldCreatePtr(new FieldCreate()); + if(fieldCreate.get()==0) { + fieldCreate = FieldCreatePtr(new FieldCreate()); + registerRefCounter("Field", &Field::num_instances); + } return fieldCreate; } diff --git a/src/pv/pvIntrospect.h b/src/pv/pvIntrospect.h index f013bd1..b8fe5b8 100644 --- a/src/pv/pvIntrospect.h +++ b/src/pv/pvIntrospect.h @@ -292,6 +292,8 @@ class epicsShareClass Field : virtual public Serializable, public std::tr1::enable_shared_from_this { public: + static size_t num_instances; + POINTER_DEFINITIONS(Field); /** * Destructor. @@ -322,7 +324,7 @@ protected: */ Field(Type type); private: - Type m_fieldType; + const Type m_fieldType; friend class StructureArray; friend class Structure;