Improve memory usage for the config compiler

This commit is contained in:
Gunnar Beutner 2014-11-05 08:55:00 +01:00
parent c4ba3f6691
commit 4eb37563b4
2 changed files with 5 additions and 7 deletions

View File

@ -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);

View File

@ -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. */