From 89cd10fbcc0bcbb3c55e9969ece5454818c30991 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 28 Nov 2016 17:07:49 +0000 Subject: [PATCH] tidies some things up and removes SOE memory manager overriding --- .../src/shared/DatabaseProcess.cpp | 11 ----------- .../serverDatabase/src/shared/Persister.cpp | 18 +++++------------- .../serverDatabase/src/shared/Snapshot.cpp | 8 +++++--- .../serverDatabase/src/shared/Snapshot.h | 4 ++-- .../src/shared/TaskSaveSnapshot.cpp | 5 +++-- .../src/shared/TaskSaveSnapshot.h | 2 +- .../console/ConsoleCommandParserServer.cpp | 3 +-- .../serverMetrics/src/shared/MetricsData.cpp | 7 ------- .../src/shared/ScriptMethodsDebug.cpp | 3 --- .../src/shared/ZlibCompressor.cpp | 5 ++--- .../src_oci/OciSession.cpp | 2 +- .../sharedDebug/src/shared/InstallTimer.cpp | 5 +---- .../sharedDebug/src/shared/InstallTimer.h | 1 - .../src/linux/SetupSharedFoundation.cpp | 3 --- .../sharedMemoryManager/src/linux/OsNewDel.cpp | 4 ++-- .../sharedMemoryManager/src/linux/OsNewDel.h | 3 +++ .../src/shared/MemoryManager.cpp | 2 +- .../src/shared/CachedFileManager.cpp | 6 ------ .../src/shared/core/SetupSharedXml.cpp | 2 +- .../src/shared/tree/XmlTreeDocumentList.cpp | 9 --------- .../src/shared/buffers/ObjvarBuffer.cpp | 6 ------ .../src/shared/buffers/ObjvarBuffer.h | 11 ++++++++++- .../src/shared/core/SwgSnapshot.cpp | 1 + .../src/shared/core/SwgSnapshot.h | 1 - 24 files changed, 39 insertions(+), 83 deletions(-) diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp index 4df57236..f5dcb25c 100755 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp @@ -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(Os::getProcessId())),MemoryManager::getProcessVmSizeKBytes(static_cast(Os::getProcessId())),MemoryManager::getCurrentNumberOfAllocations(),MemoryManagerNamespace::ms_allocateCalls)); -#else - LOG("DatabaseMemory",("Bytes used: %lu Open allocations: %d Total Allocations %d",MemoryManager::getCurrentNumberOfBytesAllocated(static_cast(Os::getProcessId())),MemoryManager::getCurrentNumberOfAllocations(),MemoryManagerNamespace::ms_allocateCalls)); -#endif - nextMemoryReportTime=10; - } nextQueryCountTime-=updateTime; if (nextQueryCountTime < 0) diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index 25217f4d..218e47f2 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -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!")); - } } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/Snapshot.cpp b/engine/server/library/serverDatabase/src/shared/Snapshot.cpp index ab3203bc..b1db9d33 100755 --- a/engine/server/library/serverDatabase/src/shared/Snapshot.cpp +++ b/engine/server/library/serverDatabase/src/shared/Snapshot.cpp @@ -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)); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/Snapshot.h b/engine/server/library/serverDatabase/src/shared/Snapshot.h index 65cc879a..a5876cd2 100755 --- a/engine/server/library/serverDatabase/src/shared/Snapshot.h +++ b/engine/server/library/serverDatabase/src/shared/Snapshot.h @@ -79,8 +79,8 @@ public: virtual void startLoadAfterSaveComplete() =0; protected: - typedef std::vector BufferListType; - typedef std::vector LocatorListType; + typedef std::vector BufferListType; + typedef std::vector LocatorListType; typedef std::vector CustomStepListType; /** diff --git a/engine/server/library/serverDatabase/src/shared/TaskSaveSnapshot.cpp b/engine/server/library/serverDatabase/src/shared/TaskSaveSnapshot.cpp index 4207b8b1..a9f7c906 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskSaveSnapshot.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskSaveSnapshot.cpp @@ -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; } // ====================================================================== diff --git a/engine/server/library/serverDatabase/src/shared/TaskSaveSnapshot.h b/engine/server/library/serverDatabase/src/shared/TaskSaveSnapshot.h index b87f532c..81fd76a8 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskSaveSnapshot.h +++ b/engine/server/library/serverDatabase/src/shared/TaskSaveSnapshot.h @@ -22,7 +22,7 @@ class TaskSaveSnapshot : public DB::TaskRequest TaskSaveSnapshot(Snapshot *snapshot); bool process(DB::Session *session); void onComplete(); - + private: Snapshot *m_snapshot; }; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp index 0e2e490f..b65eb5e7 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp @@ -96,7 +96,6 @@ static const CommandParser::CmdInfo cmds[] = {"error", 1, "", "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, " ", "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, "", "Release Authority for object with oid."}, @@ -3518,4 +3517,4 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const return true; } -// ====================================================================== \ No newline at end of file +// ====================================================================== diff --git a/engine/server/library/serverMetrics/src/shared/MetricsData.cpp b/engine/server/library/serverMetrics/src/shared/MetricsData.cpp index 20ffb1fc..c5f0d801 100755 --- a/engine/server/library/serverMetrics/src/shared/MetricsData.cpp +++ b/engine/server/library/serverMetrics/src/shared/MetricsData.cpp @@ -77,13 +77,6 @@ const GameNetworkMessage & MetricsData::getDataToSend() void MetricsData::updateData() { - m_data[m_memoryUtilization].m_value = static_cast(MemoryManager::getCurrentNumberOfBytesAllocated(static_cast(Os::getProcessId())) / 1024); - m_data[m_memoryUtilizationNoLeakTest].m_value = static_cast(MemoryManager::getCurrentNumberOfBytesAllocatedNoLeakTest() / 1024); - m_data[m_memoryAllocated].m_value = MemoryManager::getSystemMemoryAllocatedMegabytes() * 1024; -#ifndef _WIN32 - m_data[m_memoryVmSize].m_value = MemoryManager::getProcessVmSizeKBytes(static_cast(Os::getProcessId())); -#endif - //deal with frame time float frameTime = Clock::frameTime() * 1000; float oldFrameTime = m_frameTimeHistory[m_frameTimeHistoryIndex]; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp index 6769ff57..396a27b2 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp @@ -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(); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp index 8a0515a8..23286d80 100755 --- a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp +++ b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp @@ -11,7 +11,6 @@ #include "sharedDebug/DebugFlags.h" #include "sharedFoundation/ExitChain.h" -#include "sharedMemoryManager/MemoryManager.h" #include "sharedSynchronization/Mutex.h" #include "zlib.h" @@ -88,10 +87,10 @@ void ZlibCompressorNamespace::freeWrapper(voidpf opaque, voidpf address) void ZlibCompressor::install(int numberOfParallelThreads) { - if (numberOfParallelThreads <= 1 || MemoryManager::getLimit() < 260) + if (numberOfParallelThreads <= 1) ms_poolElementCount = 5; else - if (numberOfParallelThreads <= 2 || MemoryManager::getLimit() < 375) + if (numberOfParallelThreads <= 2) ms_poolElementCount = 10; else ms_poolElementCount = 15; diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp index e7e7bc66..b4179cde 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp @@ -41,7 +41,7 @@ static dvoid *mallocHook(dvoid *, size_t size) static dvoid *reallocHook(dvoid *, dvoid *memptr, size_t newsize) { - return reinterpret_cast(MemoryManager::reallocate(memptr, newsize)); + return reinterpret_cast(realloc(memptr, newsize)); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp index 80e21bc9..81fcce87 100755 --- a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp +++ b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp @@ -39,8 +39,7 @@ void InstallTimer::checkConfigFile() InstallTimer::InstallTimer(char const * description) : m_description(description), - m_performanceTimer(), - m_startingNumberOfBytesAllocated(MemoryManager::getCurrentNumberOfBytesAllocated()) + m_performanceTimer() { NOT_NULL(m_description); m_performanceTimer.start(); @@ -61,9 +60,7 @@ void InstallTimer::manualExit() if (m_description) { m_performanceTimer.stop(); - unsigned long const endingNumberOfBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); --ms_indent; - REPORT_LOG_PRINT(ms_enabled, ("InstallTimer:%*c%6.4f %d %s\n", ms_indent * 2, ' ', m_performanceTimer.getElapsedTime(), static_cast(endingNumberOfBytesAllocated - m_startingNumberOfBytesAllocated), m_description)); m_description = nullptr; } } diff --git a/engine/shared/library/sharedDebug/src/shared/InstallTimer.h b/engine/shared/library/sharedDebug/src/shared/InstallTimer.h index 122444e0..5a8d3f42 100755 --- a/engine/shared/library/sharedDebug/src/shared/InstallTimer.h +++ b/engine/shared/library/sharedDebug/src/shared/InstallTimer.h @@ -38,7 +38,6 @@ private: char const * m_description; PerformanceTimer m_performanceTimer; - unsigned long const m_startingNumberOfBytesAllocated; }; // ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index 65130ea2..ce7cfaa3 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -51,9 +51,6 @@ void SetupSharedFoundation::install(const Data &data) //@todo there is a lot of stuff in win32 setup not here...like exitchain Profiler::registerDebugFlags(); -#if _DEBUG - MemoryManager::registerDebugFlags(); -#endif//_DEBUG // Setup Linux DebugMonitor support. // @todo fix this dependency: DebugMonitor really should be moved into Foundation the way things currently are. TRF is following the existing win32 setup. diff --git a/engine/shared/library/sharedMemoryManager/src/linux/OsNewDel.cpp b/engine/shared/library/sharedMemoryManager/src/linux/OsNewDel.cpp index 9ab1fce2..8d6fb02e 100755 --- a/engine/shared/library/sharedMemoryManager/src/linux/OsNewDel.cpp +++ b/engine/shared/library/sharedMemoryManager/src/linux/OsNewDel.cpp @@ -5,7 +5,7 @@ // Copyright 2002 Sony Online Entertainment // // ====================================================================== - +/* #include "sharedMemoryManager/FirstSharedMemoryManager.h" #include "sharedMemoryManager/MemoryManager.h" #include "sharedMemoryManager/OsNewDel.h" @@ -88,6 +88,6 @@ void operator delete[](void *pointer, const char *file, int line) throw() if (pointer) MemoryManager::free(pointer, true); } - +*/ // ====================================================================== diff --git a/engine/shared/library/sharedMemoryManager/src/linux/OsNewDel.h b/engine/shared/library/sharedMemoryManager/src/linux/OsNewDel.h index 46595a62..a1e0a64c 100755 --- a/engine/shared/library/sharedMemoryManager/src/linux/OsNewDel.h +++ b/engine/shared/library/sharedMemoryManager/src/linux/OsNewDel.h @@ -17,16 +17,19 @@ enum MemoryManagerNotALeak MM_notALeak }; +/* void *operator new(size_t size, MemoryManagerNotALeak); void *operator new(size_t size); void *operator new[](std::size_t size); void *operator new(size_t size, char const *file, int line); void *operator new[](size_t size, char const *file, int line); + void operator delete(void *pointer) throw(); void operator delete[](void *pointer) throw(); void operator delete(void *pointer, char const *file, int line) throw(); void operator delete[](void *pointer, char const *file, int line) throw(); +*/ // ====================================================================== diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 9407855b..cbf83b1e 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -1349,7 +1349,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) if (newSize <= static_cast(oldSize)) { -// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=%p\n", newSize, userPointer, userPointer)); +// DEBUG_REPORT_LOG(ms_logEachAlloc, ("realloc() new_requested_size=%d, org ptr=%p, new ptr=%p\n", newSize, userPointer, userPointer)); return userPointer; } diff --git a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp index 398ef20e..468c8d00 100755 --- a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp @@ -186,10 +186,6 @@ void CachedFileManager::preloadSomeAssets () { unsigned long const startTime = Clock::timeMs (); -#if PRODUCTION == 0 - unsigned long const bytesBefore = MemoryManager::getCurrentNumberOfBytesAllocated(); -#endif - //-- preloading occurs in one second slices while (ms_filenamesCurrentPos < ms_filenamesLength && Clock::timeMs () - startTime < 1000) { @@ -229,8 +225,6 @@ void CachedFileManager::preloadSomeAssets () #if PRODUCTION == 0 unsigned long const stopTime = Clock::timeMs (); ms_totalTime += stopTime - startTime; - - ms_totalAllocatedBytes += MemoryManager::getCurrentNumberOfBytesAllocated() - bytesBefore; #endif if (donePreloading ()) diff --git a/engine/shared/library/sharedXml/src/shared/core/SetupSharedXml.cpp b/engine/shared/library/sharedXml/src/shared/core/SetupSharedXml.cpp index 750e4a46..dc037cd0 100755 --- a/engine/shared/library/sharedXml/src/shared/core/SetupSharedXml.cpp +++ b/engine/shared/library/sharedXml/src/shared/core/SetupSharedXml.cpp @@ -71,7 +71,7 @@ char *SetupSharedXmlNamespace::xmlDuplicateString(char const *source) void *SetupSharedXmlNamespace::xmlReAllocate(void *memory, size_t byteCount) { - return MemoryManager::reallocate(memory, byteCount); + return realloc(memory, byteCount); } // ====================================================================== diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp index 2299aaf5..72932b48 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp @@ -116,18 +116,9 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) delete file; //-- Create an XML DOM tree out of it. -#ifdef _DEBUG - unsigned long const preDomBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); -#endif - xmlDocPtr const xmlDocument = xmlParseMemory(reinterpret_cast(fileContents), fileSize); FATAL(!xmlDocument, ("xmlParseMemory() returned nullptr when parsing contents of file [%s].", cPathName)); -#ifdef _DEBUG - unsigned long const postDomBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); - DEBUG_REPORT_LOG(s_logXmlDomTreeSize, ("XmlTreeDocumentList: XML tree file [%s]: XML DOM tree appears to have consumed [%d] bytes.\n", cPathName, static_cast(postDomBytesAllocated - preDomBytesAllocated))); -#endif - // Release initial file contents buffer. delete [] fileContents; diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjvarBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjvarBuffer.cpp index bf736c7c..2784757b 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjvarBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjvarBuffer.cpp @@ -40,12 +40,6 @@ ObjvarBuffer::~ObjvarBuffer() { } -// ---------------------------------------------------------------------- - -/** - * Loads all the object variables for the remembered objectId's - */ - bool ObjvarBuffer::load(DB::Session *session,const DB::TagSet &tags, const std::string &schema, bool usingGoldDatabase) { int rowsFetched; diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjvarBuffer.h b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjvarBuffer.h index 61ff386b..f834649b 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjvarBuffer.h +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjvarBuffer.h @@ -16,7 +16,7 @@ #include "sharedFoundation/DynamicVariableList.h" #include #include - +#include // ====================================================================== class ObjectTableBuffer; @@ -61,6 +61,9 @@ public: int m_nameId; IndexKey(const NetworkId &objectId, int nameId); + ~IndexKey(){ + m_nameId = 0; + } bool operator==(const IndexKey &rhs) const; bool operator<(const IndexKey &rhs) const; }; @@ -71,6 +74,12 @@ public: std::string m_value; bool m_detached; bool m_inDatabase; + ~ObjvarValue(){ + m_type = 0; + m_detached = 0; + m_inDatabase = 0; + m_value.clear(); + } }; typedef std::map DataType; diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp index ccb9ccad..eee98f61 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp @@ -141,6 +141,7 @@ SwgSnapshot::SwgSnapshot(DB::ModeQuery::Mode mode, bool useGoldDatabase) : SwgSnapshot::~SwgSnapshot() { + m_objvarBuffer.~ObjvarBuffer(); } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.h b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.h index ee36cc39..e2494000 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.h +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.h @@ -30,7 +30,6 @@ #include "SwgDatabaseServer/Schema.h" #include "SwgDatabaseServer/ScriptBuffer.h" #include "SwgDatabaseServer/WaypointBuffer.h" - namespace DB { class Session;