tidies some things up and removes SOE memory manager overriding

This commit is contained in:
DarthArgus
2016-11-28 17:07:49 +00:00
parent 1867ee7cc9
commit 89cd10fbcc
24 changed files with 39 additions and 83 deletions
@@ -197,7 +197,6 @@ void DatabaseProcess::run(void)
static bool shouldSleep = ConfigServerDatabase::getShouldSleep();
bool idle=false;
int loopcount=0;
float nextMemoryReportTime=0;
float nextQueryCountTime=0;
LOG("ServerStartup",("DatabaseServer starting"));
@@ -240,16 +239,6 @@ void DatabaseProcess::run(void)
PROFILER_AUTO_BLOCK_DEFINE("NetworkHandler::update");
NetworkHandler::update();
}
nextMemoryReportTime-=updateTime;
if (nextMemoryReportTime < 0)
{
#ifndef _WIN32
LOG("DatabaseMemory",("Bytes used: %lu (VmSize %dK) Open allocations: %d Total Allocations %d",MemoryManager::getCurrentNumberOfBytesAllocated(static_cast<int>(Os::getProcessId())),MemoryManager::getProcessVmSizeKBytes(static_cast<int>(Os::getProcessId())),MemoryManager::getCurrentNumberOfAllocations(),MemoryManagerNamespace::ms_allocateCalls));
#else
LOG("DatabaseMemory",("Bytes used: %lu Open allocations: %d Total Allocations %d",MemoryManager::getCurrentNumberOfBytesAllocated(static_cast<int>(Os::getProcessId())),MemoryManager::getCurrentNumberOfAllocations(),MemoryManagerNamespace::ms_allocateCalls));
#endif
nextMemoryReportTime=10;
}
nextQueryCountTime-=updateTime;
if (nextQueryCountTime < 0)
@@ -336,10 +336,10 @@ void Persister::startSave(void)
taskQueue->asyncRequest(new TaskSaveSnapshot(i->second));
}
for (i=m_newObjectSnapshots.begin(); i!=m_newObjectSnapshots.end(); ++i)
{
m_savingSnapshots.push_back(i->second);
taskQueue->asyncRequest(new TaskSaveSnapshot(i->second));
}
{
m_savingSnapshots.push_back(i->second);
taskQueue->asyncRequest(new TaskSaveSnapshot(i->second));
}
// nothing changed so send a complete message for the shutdown process
if( m_savingSnapshots.empty() )
@@ -603,7 +603,6 @@ void Persister::saveCompleted(Snapshot *completedSnapshot)
if (i!=m_savingSnapshots.end())
{
m_savingSnapshots.erase(i, m_savingSnapshots.end());
if (m_savingSnapshots.empty() && ConfigServerDatabase::getReportSaveTimes())
{
int saveTime = Clock::timeMs() - m_saveStartTime;
@@ -635,16 +634,9 @@ 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());
m_savingCharacterSnapshots.erase(j, m_savingCharacterSnapshots.end());
DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n"));
}
if (completedSnapshot) {
delete completedSnapshot;
completedSnapshot = nullptr; // in case of double deletes by any other pointers to this thing
} else {
DEBUG_WARNING(true, ("We just attempted a double delete!"));
}
}
// ----------------------------------------------------------------------
@@ -42,14 +42,16 @@ Snapshot::~Snapshot()
for (LocatorListType::iterator i=m_locatorList.begin(); i!=m_locatorList.end(); ++i)
{
delete *i;
*i=0;
i = m_locatorList.erase(i);
}
for (CustomStepListType::iterator j=m_customStepList.begin(); j!=m_customStepList.end(); ++j)
for (CustomStepListType::iterator j=m_customStepList.begin(); j!=m_customStepList.end(); ++j) {
delete *j;
j = m_customStepList.erase(j);
}
++ms_deletionCount;
LOG("Snapshot",("Deleted snapshot. %i outstanding, %i created, %i deleted", ms_creationCount-ms_deletionCount,ms_creationCount,ms_deletionCount));
LOG("Snapshot",("Deleted snapshot. %i outstanding, %i created, %i deleted", ms_creationCount-ms_deletionCount,ms_creationCount,ms_deletionCount));
}
// ----------------------------------------------------------------------
@@ -79,8 +79,8 @@ public:
virtual void startLoadAfterSaveComplete() =0;
protected:
typedef std::vector<AbstractTableBuffer*> BufferListType;
typedef std::vector<ObjectLocator*> LocatorListType;
typedef std::vector<AbstractTableBuffer *> BufferListType;
typedef std::vector<ObjectLocator *> LocatorListType;
typedef std::vector<CustomPersistStep*> CustomStepListType;
/**
@@ -14,8 +14,7 @@
// ======================================================================
TaskSaveSnapshot::TaskSaveSnapshot(Snapshot *snapshot) :
m_snapshot(snapshot)
TaskSaveSnapshot::TaskSaveSnapshot(Snapshot *snapshot) : m_snapshot(snapshot)
{
}
@@ -32,6 +31,8 @@ void TaskSaveSnapshot::onComplete()
{
m_snapshot->saveCompleted();
Persister::getInstance().saveCompleted(m_snapshot);
delete m_snapshot;
m_snapshot = nullptr;
}
// ======================================================================
@@ -22,7 +22,7 @@ class TaskSaveSnapshot : public DB::TaskRequest
TaskSaveSnapshot(Snapshot *snapshot);
bool process(DB::Session *session);
void onComplete();
private:
Snapshot *m_snapshot;
};
@@ -96,7 +96,6 @@ static const CommandParser::CmdInfo cmds[] =
{"error", 1, "<error message>", "Display an error message."},
{"getPlanetId", 0, "[planet]", "Get the current obj_id of the planet for this server (or for the specified planet)."},
{"memUsage", 0, "", "Query memory usage statistics."},
{"memoryReport", 0, "", "Dump memory manager (call MemoryManager::report())."},
{"dumpMemToFile", 2, "<fileName> <leaksOnly>", "Dump memory report to file on server, can be called to dump all allocations or only known leaks."},
{"clock", 0, "", "Query clock statistics."},
{"releaseAuth", 1, "<oid>", "Release Authority for object with oid."},
@@ -3518,4 +3517,4 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
return true;
}
// ======================================================================
// ======================================================================
@@ -77,13 +77,6 @@ const GameNetworkMessage & MetricsData::getDataToSend()
void MetricsData::updateData()
{
m_data[m_memoryUtilization].m_value = static_cast<int>(MemoryManager::getCurrentNumberOfBytesAllocated(static_cast<int>(Os::getProcessId())) / 1024);
m_data[m_memoryUtilizationNoLeakTest].m_value = static_cast<int>(MemoryManager::getCurrentNumberOfBytesAllocatedNoLeakTest() / 1024);
m_data[m_memoryAllocated].m_value = MemoryManager::getSystemMemoryAllocatedMegabytes() * 1024;
#ifndef _WIN32
m_data[m_memoryVmSize].m_value = MemoryManager::getProcessVmSizeKBytes(static_cast<int>(Os::getProcessId()));
#endif
//deal with frame time
float frameTime = Clock::frameTime() * 1000;
float oldFrameTime = m_frameTimeHistory[m_frameTimeHistoryIndex];
@@ -354,7 +354,6 @@ void JNICALL ScriptMethodsDebugNamespace::profilerStopAccum(JNIEnv *env, jobject
void JNICALL ScriptMethodsDebugNamespace::disableGameMemoryDump(JNIEnv *env, jobject self)
{
UNREF(self);
MemoryManager::setReportAllocations(false);
NetworkIdManager::setReportObjectLeaks(false);
}
@@ -363,7 +362,6 @@ void JNICALL ScriptMethodsDebugNamespace::disableGameMemoryDump(JNIEnv *env, job
void JNICALL ScriptMethodsDebugNamespace::debugMemoryReport(JNIEnv *env, jobject self)
{
UNREF(self);
MemoryManager::debugReport();
}
// ----------------------------------------------------------------------
@@ -371,7 +369,6 @@ void JNICALL ScriptMethodsDebugNamespace::debugMemoryReport(JNIEnv *env, jobject
void JNICALL ScriptMethodsDebugNamespace::debugMemoryReportMap(JNIEnv *env, jobject self)
{
UNREF(self);
MemoryManager::debugReportMap();
}
// ----------------------------------------------------------------------