mirror of https://github.com/Icinga/icinga2.git
Improve memory usage for the config compiler
This commit is contained in:
parent
c4ba3f6691
commit
4eb37563b4
|
@ -130,15 +130,13 @@ Dictionary::Ptr ConfigItem::GetProperties(void)
|
||||||
locals->Set("__parent", m_Scope);
|
locals->Set("__parent", m_Scope);
|
||||||
locals->Set("name", m_Name);
|
locals->Set("name", m_Name);
|
||||||
|
|
||||||
DebugHint dhint;
|
|
||||||
m_Properties = make_shared<Dictionary>();
|
m_Properties = make_shared<Dictionary>();
|
||||||
m_Properties->Set("type", m_Type);
|
m_Properties->Set("type", m_Type);
|
||||||
if (!m_Zone.IsEmpty())
|
if (!m_Zone.IsEmpty())
|
||||||
m_Properties->Set("zone", m_Zone);
|
m_Properties->Set("zone", m_Zone);
|
||||||
m_Properties->Set("__parent", locals);
|
m_Properties->Set("__parent", locals);
|
||||||
GetExpressionList()->Evaluate(m_Properties, &dhint);
|
GetExpressionList()->Evaluate(m_Properties, &m_DebugHints);
|
||||||
m_Properties->Remove("__parent");
|
m_Properties->Remove("__parent");
|
||||||
m_DebugHints = dhint.ToDictionary();
|
|
||||||
|
|
||||||
String name = m_Name;
|
String name = m_Name;
|
||||||
|
|
||||||
|
@ -164,7 +162,7 @@ Dictionary::Ptr ConfigItem::GetProperties(void)
|
||||||
return m_Properties;
|
return m_Properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr ConfigItem::GetDebugHints(void) const
|
const DebugHint& ConfigItem::GetDebugHints(void) const
|
||||||
{
|
{
|
||||||
return m_DebugHints;
|
return m_DebugHints;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +307,7 @@ void ConfigItem::WriteObjectsFile(const String& filename)
|
||||||
persistentItem->Set("type", item->GetType());
|
persistentItem->Set("type", item->GetType());
|
||||||
persistentItem->Set("name", item->GetName());
|
persistentItem->Set("name", item->GetName());
|
||||||
persistentItem->Set("properties", item->GetProperties());
|
persistentItem->Set("properties", item->GetProperties());
|
||||||
persistentItem->Set("debug_hints", item->GetDebugHints());
|
persistentItem->Set("debug_hints", item->GetDebugHints().ToDictionary());
|
||||||
|
|
||||||
String json = JsonEncode(persistentItem);
|
String json = JsonEncode(persistentItem);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
|
|
||||||
Expression::Ptr GetExpressionList(void) const;
|
Expression::Ptr GetExpressionList(void) const;
|
||||||
Dictionary::Ptr GetProperties(void);
|
Dictionary::Ptr GetProperties(void);
|
||||||
Dictionary::Ptr GetDebugHints(void) const;
|
const DebugHint& GetDebugHints(void) const;
|
||||||
|
|
||||||
DynamicObject::Ptr Commit(void);
|
DynamicObject::Ptr Commit(void);
|
||||||
void Register(void);
|
void Register(void);
|
||||||
|
@ -79,7 +79,7 @@ private:
|
||||||
|
|
||||||
Expression::Ptr m_ExpressionList;
|
Expression::Ptr m_ExpressionList;
|
||||||
Dictionary::Ptr m_Properties;
|
Dictionary::Ptr m_Properties;
|
||||||
Dictionary::Ptr m_DebugHints;
|
DebugHint m_DebugHints;
|
||||||
std::vector<String> m_ParentNames; /**< The names of parent configuration
|
std::vector<String> m_ParentNames; /**< The names of parent configuration
|
||||||
items. */
|
items. */
|
||||||
DebugInfo m_DebugInfo; /**< Debug information. */
|
DebugInfo m_DebugInfo; /**< Debug information. */
|
||||||
|
|
Loading…
Reference in New Issue