[icinga-checkins] icinga.org: icinga2/master: Improve memory usage for the config compiler

git at icinga.org git at icinga.org
Wed Nov 5 08:58:37 CET 2014


Module: icinga2
Branch: master
Commit: 4eb37563b40fc35237c6e5a8d2670f63dc60034a
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=4eb37563b40fc35237c6e5a8d2670f63dc60034a

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Nov  5 08:55:00 2014 +0100

Improve memory usage for the config compiler

---

 lib/config/configitem.cpp |    8 +++-----
 lib/config/configitem.hpp |    4 ++--
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp
index 45cd19c..8dbde2d 100644
--- a/lib/config/configitem.cpp
+++ b/lib/config/configitem.cpp
@@ -130,15 +130,13 @@ Dictionary::Ptr ConfigItem::GetProperties(void)
 		locals->Set("__parent", m_Scope);
 		locals->Set("name", m_Name);
 
-		DebugHint dhint;
 		m_Properties = make_shared<Dictionary>();
 		m_Properties->Set("type", m_Type);
 		if (!m_Zone.IsEmpty())
 			m_Properties->Set("zone", m_Zone);
 		m_Properties->Set("__parent", locals);
-		GetExpressionList()->Evaluate(m_Properties, &dhint);
+		GetExpressionList()->Evaluate(m_Properties, &m_DebugHints);
 		m_Properties->Remove("__parent");
-		m_DebugHints = dhint.ToDictionary();
 
 		String name = m_Name;
 
@@ -164,7 +162,7 @@ Dictionary::Ptr ConfigItem::GetProperties(void)
 	return m_Properties;
 }
 
-Dictionary::Ptr ConfigItem::GetDebugHints(void) const
+const DebugHint& ConfigItem::GetDebugHints(void) const
 {
 	return m_DebugHints;
 }
@@ -309,7 +307,7 @@ void ConfigItem::WriteObjectsFile(const String& filename)
 		persistentItem->Set("type", item->GetType());
 		persistentItem->Set("name", item->GetName());
 		persistentItem->Set("properties", item->GetProperties());
-		persistentItem->Set("debug_hints", item->GetDebugHints());
+		persistentItem->Set("debug_hints", item->GetDebugHints().ToDictionary());
 
 		String json = JsonEncode(persistentItem);
 
diff --git a/lib/config/configitem.hpp b/lib/config/configitem.hpp
index 7d90524..0694cb9 100644
--- a/lib/config/configitem.hpp
+++ b/lib/config/configitem.hpp
@@ -49,7 +49,7 @@ public:
 
 	Expression::Ptr GetExpressionList(void) const;
 	Dictionary::Ptr GetProperties(void);
-	Dictionary::Ptr GetDebugHints(void) const;
+	const DebugHint& GetDebugHints(void) const;
 
 	DynamicObject::Ptr Commit(void);
 	void Register(void);
@@ -79,7 +79,7 @@ private:
 
 	Expression::Ptr m_ExpressionList;
 	Dictionary::Ptr m_Properties;
-	Dictionary::Ptr m_DebugHints;
+	DebugHint m_DebugHints;
 	std::vector<String> m_ParentNames; /**< The names of parent configuration
 				       items. */
 	DebugInfo m_DebugInfo; /**< Debug information. */



More information about the icinga-checkins mailing list