cleanup works and reduces our memory footprint, and error messages

This commit is contained in:
DarthArgus
2016-12-04 00:56:25 +00:00
parent 12cf580937
commit cbfc88d54b
2 changed files with 17 additions and 45 deletions
@@ -174,44 +174,15 @@ Persister::~Persister()
{
DEBUG_FATAL(taskQueue,("Call shutdown() before deleting Persister.\n"));
for (auto i = m_currentSnapshots.begin(); i!=m_currentSnapshots.end(); ++i) {
ServerSnapshotMap::iterator i;
for (i=m_currentSnapshots.begin(); i!=m_currentSnapshots.end(); ++i)
delete i->second;
i->second = nullptr;
}
for (auto i = m_newObjectSnapshots.begin(); i!=m_newObjectSnapshots.end(); ++i) {
for (i=m_newObjectSnapshots.begin(); i!=m_newObjectSnapshots.end(); ++i)
delete i->second;
i->second = nullptr;
}
for (auto i = m_newCharacterSnapshots.begin(); i!=m_newCharacterSnapshots.end(); ++i) {
delete i->second;
i->second = nullptr;
}
for (auto i = m_objectSnapshotMap.begin(); i!=m_objectSnapshotMap.end(); ++i) {
delete i->second;
i->second = nullptr;
}
for (auto i = m_savingSnapshots.begin(); i!=m_savingSnapshots.end(); ++i) {
delete *i;
*i = nullptr;
}
for (auto i = m_savingCharacterSnapshots.begin(); i!=m_savingCharacterSnapshots.end(); ++i) {
delete *i;
*i = nullptr;
}
m_currentSnapshots.clear();
m_newObjectSnapshots.clear();
m_objectSnapshotMap.clear();
delete m_messageSnapshot;
delete m_commoditiesSnapshot;
delete m_arbitraryGameDataSnapshot;
m_messageSnapshot = nullptr;
m_commoditiesSnapshot = nullptr;
m_arbitraryGameDataSnapshot = nullptr;
@@ -663,6 +634,7 @@ void Persister::saveCompleted(Snapshot *completedSnapshot)
{
SnapshotListType::iterator j=std::remove(m_savingCharacterSnapshots.begin(),m_savingCharacterSnapshots.end(),completedSnapshot);
DEBUG_FATAL(i==m_savingCharacterSnapshots.end(),("Programmer bug: SaveCompleted() called with a snapshot that wasn't in m_savingSnapshots or m_savingCharacterSnapshots."));
m_savingCharacterSnapshots.erase(j, m_savingCharacterSnapshots.end());
DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n"));
}