Merge branch 'testing'

This commit is contained in:
DarthArgus
2016-12-03 08:28:47 +00:00
138 changed files with 189 additions and 3140 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ elseif(UNIX)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
#endif()
add_definitions(-DLINUX -D_REENTRANT -Dlinux -DSTELLA_INTERNAL -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500)
add_definitions(-DLINUX -D_REENTRANT -Dlinux -DSTELLA_INTERNAL -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500)
endif()
add_subdirectory(external)
+6
View File
@@ -40,6 +40,12 @@ if(DEFINED ENV{ORACLE_HOME})
/usr/share/oracle/12.1/client64
/usr/lib/oracle/12.1/client
/usr/share/oracle/12.1/client
/usr/include/oracle/10.2.0.4/client64
/usr/include/oracle/10.2.0.4/client
/usr/lib/oracle/10.2.0.4/client64
/usr/share/oracle/10.2.0.4/client64
/usr/lib/oracle/10.2.0.4/client
/usr/share/oracle/10.2.0.4/client
${ORACLE_HOME}/rdbms/public
${ORACLE_HOME}/include
${ORACLE_HOME}/sdk/include # Oracle SDK
@@ -27,7 +27,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedThread/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/fileInterface/include/public
)
@@ -68,7 +68,7 @@ target_link_libraries(Miff
sharedFile
sharedFoundation
sharedLog
sharedMemoryManager
sharedMessageDispatch
sharedThread
fileInterface
@@ -41,7 +41,7 @@
#include "sharedFoundation/Crc.h"
#include "sharedFoundation/Os.h"
#include "sharedFoundation/SetupSharedFoundation.h"
#include "sharedMemoryManager/MemoryManager.h"
#include "sharedThread/SetupSharedThread.h"
#include "InputFileHandler.h"
@@ -41,7 +41,7 @@
#include "sharedFoundation/Crc.h"
#include "sharedFoundation/Os.h"
#include "sharedFoundation/SetupSharedFoundation.h"
#include "sharedMemoryManager/MemoryManager.h"
#include "sharedThread/SetupSharedThread.h"
#include "InputFileHandler.h"
@@ -132,7 +132,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -171,7 +171,7 @@ target_link_libraries(CentralServer
sharedGame
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -12,7 +12,7 @@
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "sharedFoundation/NetworkIdArchive.h"
#include "CentralServer.h"
@@ -50,7 +50,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -83,7 +83,7 @@ target_link_libraries(ChatServer
sharedFoundation
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -100,11 +100,11 @@ namespace ChatServerNamespace
if(fullName.find(ConfigChatServer::getClusterName()) == std::string::npos)
{
fullName = ConfigChatServer::getClusterName() + '+' + fullName;
fullName = std::string(ConfigChatServer::getClusterName()) + std::string("+") + fullName;
}
if(fullName.find(ConfigChatServer::getGameCode()) == std::string::npos)
{
fullName = ConfigChatServer::getGameCode() + '+' + fullName;
fullName = std::string(ConfigChatServer::getGameCode()) + std::string("+") + fullName;
}
if(fullName.find("SOE") == std::string::npos)
{
@@ -122,7 +122,7 @@ namespace ChatServerNamespace
std::set<NetworkId> s_notSubscribedClients;
// Control log output for chat room related methods
bool const s_enableChatRoomLogs = false;
bool const s_enableChatRoomLogs = false; // make configurable?
}
using namespace ChatServerNamespace;
@@ -44,7 +44,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -75,7 +75,7 @@ target_link_libraries(CommoditiesServer
sharedFile
sharedFoundation
sharedGame
sharedMemoryManager
sharedLog
sharedMessageDispatch
sharedNetwork
@@ -47,7 +47,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -83,7 +83,7 @@ target_link_libraries(ConnectionServer
sharedGame
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -45,7 +45,7 @@
#include "sharedLog/Log.h"
#include "sharedLog/LogManager.h"
#include "sharedLog/SetupSharedLog.h"
#include "sharedMemoryManager/MemoryManager.h"
#include "sharedNetwork/NetworkSetupData.h"
#include "sharedNetwork/Service.h"
#include "sharedNetwork/UdpSock.h"
@@ -11,7 +11,7 @@
// ======================================================================
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "ConnectionServer.h"
#include "sharedFoundation/NetworkIdArchive.h"
@@ -40,7 +40,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -69,7 +69,7 @@ target_link_libraries(CustomerServiceServer
sharedFoundation
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -35,7 +35,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -61,7 +61,7 @@ target_link_libraries(LogServer
sharedFoundation
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -25,7 +25,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -45,7 +45,7 @@ target_link_libraries(LoginPing
sharedDebug
sharedFile
sharedFoundation
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -90,7 +90,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -129,7 +129,7 @@ target_link_libraries(LoginServer
sharedGame
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -15,7 +15,7 @@
#include "Archive/ByteStream.h"
#include "serverUtility/ServerConnection.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "LoginServer.h"
#include "sharedNetworkMessages/GameNetworkMessage.h"
// ======================================================================
@@ -60,7 +60,7 @@
#include "sharedGame/PlatformFeatureBits.h"
#include "sharedLog/Log.h"
#include "sharedLog/SetupSharedLog.h"
#include "sharedMemoryManager/MemoryManager.h"
#include "sharedNetwork/Address.h"
#include "sharedNetwork/NetworkSetupData.h"
#include "sharedNetworkMessages/ClientCentralMessages.h"
@@ -29,7 +29,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -54,7 +54,7 @@ target_link_libraries(MetricsServer
sharedFoundation
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -53,7 +53,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -86,7 +86,7 @@ target_link_libraries(PlanetServer
sharedFoundation
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -12,7 +12,7 @@
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "sharedFoundation/NetworkIdArchive.h"
@@ -27,7 +27,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -45,7 +45,7 @@ target_link_libraries(ServerConsole
sharedDebug
sharedFile
sharedFoundation
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -31,7 +31,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -58,7 +58,7 @@ target_link_libraries(StationPlayersCollector
sharedFile
sharedFoundation
sharedLog
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -61,7 +61,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -86,7 +86,7 @@ target_link_libraries(TaskManager
sharedFoundation
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -35,7 +35,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -61,7 +61,7 @@ target_link_libraries(TransferServer
sharedFoundation
sharedLog
sharedMath
sharedMemoryManager
sharedMessageDispatch
sharedNetwork
sharedNetworkMessages
@@ -16,7 +16,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -151,7 +151,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -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)
@@ -2,6 +2,6 @@
#define INCLUDED_FirstServerDatabase_H
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#endif
@@ -174,15 +174,44 @@ Persister::~Persister()
{
DEBUG_FATAL(taskQueue,("Call shutdown() before deleting Persister.\n"));
ServerSnapshotMap::iterator i;
for (i=m_currentSnapshots.begin(); i!=m_currentSnapshots.end(); ++i)
for (auto i = m_currentSnapshots.begin(); i!=m_currentSnapshots.end(); ++i) {
delete i->second;
for (i=m_newObjectSnapshots.begin(); i!=m_newObjectSnapshots.end(); ++i)
i->second = nullptr;
}
for (auto 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;
@@ -336,10 +365,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,9 +632,6 @@ void Persister::saveCompleted(Snapshot *completedSnapshot)
if (i!=m_savingSnapshots.end())
{
m_savingSnapshots.erase(i, m_savingSnapshots.end());
delete completedSnapshot;
if (m_savingSnapshots.empty() && ConfigServerDatabase::getReportSaveTimes())
{
int saveTime = Clock::timeMs() - m_saveStartTime;
@@ -637,8 +663,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());
delete completedSnapshot;
m_savingCharacterSnapshots.erase(j, m_savingCharacterSnapshots.end());
DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n"));
}
}
@@ -42,14 +42,19 @@ Snapshot::~Snapshot()
for (LocatorListType::iterator i=m_locatorList.begin(); i!=m_locatorList.end(); ++i)
{
delete *i;
*i=0;
*i = nullptr;
}
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 = nullptr;
}
m_locatorList.clear();
m_customStepList.clear();
++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;
/**
@@ -10,12 +10,10 @@
#include "serverDatabase/Persister.h"
#include "serverDatabase/Snapshot.h"
#include "sharedFoundation/NetworkIdArchive.h" //TODO: Windows build breaks without this. Why? Makes no sense.
// ======================================================================
TaskSaveSnapshot::TaskSaveSnapshot(Snapshot *snapshot) :
m_snapshot(snapshot)
TaskSaveSnapshot::TaskSaveSnapshot(Snapshot *snapshot) : m_snapshot(snapshot)
{
}
@@ -22,7 +22,7 @@ class TaskSaveSnapshot : public DB::TaskRequest
TaskSaveSnapshot(Snapshot *snapshot);
bool process(DB::Session *session);
void onComplete();
private:
Snapshot *m_snapshot;
};
@@ -732,7 +732,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -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;
}
// ======================================================================
// ======================================================================
@@ -3235,12 +3235,10 @@ bool ServerObject::persist()
ServerObject *parent = static_cast<ServerObject*>(ContainerInterface::getContainedByObject(*this));
if (parent && !parent->isPersisted())
{
WARNING(true, ("Persisting %s into %s which is not persisted!", getNetworkId().getValueString().c_str(), parent->getNetworkId().getValueString().c_str()));
WARNING(true, ("Persisting %s into %s, which is not persisted!", getNetworkId().getValueString().c_str(), parent->getNetworkId().getValueString().c_str()));
}
#endif
m_persisted = true;
markChildrenPersisted();
sendCreateAndBaselinesToDatabaseServer();
@@ -566,7 +566,6 @@ TangibleObject::~TangibleObject()
const int maxStackDepth = 64;
const int callStackSize = callStackOffset + maxStackDepth;
uint32 callStack[callStackOffset + maxStackDepth];
DebugHelp::getCallStack(callStack, callStackOffset + maxStackDepth);
// look up the caller's file and line
if (callStack[callStackOffset])
@@ -579,10 +578,7 @@ TangibleObject::~TangibleObject()
{
if (callStack[i])
{
if (DebugHelp::lookupAddress(callStack[i], lib, file, sizeof(file), line))
REPORT_LOG(true, ("\t%s(%d) : caller %d\n", file, line, i-callStackOffset));
else
REPORT_LOG(true, ("\tunknown(0x%08X) : caller %d\n", static_cast<int>(callStack[i]), i-callStackOffset));
}
}
}
@@ -124,7 +124,7 @@ Object * ServerTangibleObjectTemplate::createObject(void) const
} // ServerTangibleObjectTemplate::createObject
//@BEGIN TFD
const TriggerVolumeData & ServerTangibleObjectTemplate::getTriggerVolumes(int index) const
const TriggerVolumeData ServerTangibleObjectTemplate::getTriggerVolumes(int index) const
{
const ServerTangibleObjectTemplate * base = nullptr;
if (m_baseData != nullptr)
@@ -155,8 +155,8 @@ const TriggerVolumeData & ServerTangibleObjectTemplate::getTriggerVolumes(int in
}
DEBUG_FATAL(index < 0 || static_cast<size_t>(index) >= m_triggerVolumes.size(), ("template param index out of range"));
const TriggerVolumeData & value = m_triggerVolumes[index]->getValue();
return value;
return m_triggerVolumes[index]->getValue();
} // ServerTangibleObjectTemplate::getTriggerVolumes
size_t ServerTangibleObjectTemplate::getTriggerVolumesCount(void) const
@@ -87,7 +87,7 @@ public:
};
public:
const TriggerVolumeData & getTriggerVolumes(int index) const;
const TriggerVolumeData getTriggerVolumes(int index) const;
size_t getTriggerVolumesCount(void) const;
CombatSkeleton getCombatSkeleton(bool testData = false) const;
int getMaxHitPoints(bool testData = false) const;
@@ -20,7 +20,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/crypto/include
@@ -12,7 +12,7 @@
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "serverKeyShare/KeyServer.h"
#include "sharedRandom/RandomGenerator.h"
@@ -24,7 +24,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -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];
@@ -492,7 +492,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -43,7 +43,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedObject/include/public
@@ -112,7 +112,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -2,7 +2,7 @@
#define INCLUDED_FirstServerScript_H
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "StringId.h"
#include <memory>
@@ -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();
}
// ----------------------------------------------------------------------
@@ -49,7 +49,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -3,6 +3,6 @@
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#endif
@@ -14,7 +14,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedIoWin/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedObject/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRegex/include/public
@@ -40,7 +40,7 @@ target_link_libraries(DataTableTool
sharedFoundation
sharedIoWin
sharedLog
sharedMemoryManager
sharedMessageDispatch
sharedObject
sharedRandom
@@ -24,7 +24,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedObject/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRegex/include/public
@@ -49,7 +49,7 @@ target_link_libraries(TemplateCompiler
sharedFile
sharedFoundation
sharedLog
sharedMemoryManager
sharedMessageDispatch
sharedObject
sharedRandom
@@ -24,7 +24,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedObject/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRegex/include/public
@@ -49,7 +49,7 @@ target_link_libraries(TemplateDefinitionCompiler
sharedFile
sharedFoundation
sharedLog
sharedMemoryManager
sharedMessageDispatch
sharedObject
sharedRandom
-1
View File
@@ -14,7 +14,6 @@ add_subdirectory(sharedIoWin)
add_subdirectory(sharedLog)
add_subdirectory(sharedMath)
add_subdirectory(sharedMathArchive)
add_subdirectory(sharedMemoryManager)
add_subdirectory(sharedMessageDispatch)
add_subdirectory(sharedNetwork)
add_subdirectory(sharedNetworkMessages)
@@ -140,7 +140,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedObject/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedTerrain/include/public
@@ -24,7 +24,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include
)
@@ -28,7 +28,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
${ZLIB_INCLUDE_DIR}
)
@@ -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;
@@ -80,7 +80,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedThread/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include
@@ -12,7 +12,7 @@
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
// ======================================================================
@@ -15,7 +15,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include
${ORACLE_INCLUDE_DIR}
@@ -41,7 +41,7 @@ static dvoid *mallocHook(dvoid *, size_t size)
static dvoid *reallocHook(dvoid *, dvoid *memptr, size_t newsize)
{
return reinterpret_cast<dvoid *>(MemoryManager::reallocate(memptr, newsize));
return reinterpret_cast<dvoid *>(realloc(memptr, newsize));
}
// ----------------------------------------------------------------------
@@ -81,26 +81,6 @@ bool DB::OCISession::connect()
// so that each session can be used by a different thread concurrently.
sword result=OCI_ERROR;
if (m_server->getUseMemoryManager())
{
result = OCIEnvCreate(&envhp, // OCIEnv **envhpp,
OCI_THREADED | OCI_OBJECT, //ub4 mode, //TODO: do we have to use threaded mode?
0, // CONST dvoid *ctxp,
&mallocHook, // CONST dvoid *(*malocfp)
// (dvoid *ctxp,
// size_t size),
&reallocHook, // CONST dvoid *(*ralocfp)
// (dvoid *ctxp,
// dvoid *memptr,
// size_t newsize),
&freeHook, // CONST void (*mfreefp)
// (dvoid *ctxp,
// dvoid *memptr))
0, //size_t xtramemsz,
0 ); //dvoid **usrmempp );
}
else
{
result = OCIEnvCreate(&envhp, // OCIEnv **envhpp,
OCI_THREADED | OCI_OBJECT, //ub4 mode, //TODO: do we have to use threaded mode?
0, // CONST dvoid *ctxp,
@@ -117,7 +97,6 @@ bool DB::OCISession::connect()
0, //size_t xtramemsz,
0 ); //dvoid **usrmempp );
}
FATAL(result != OCI_SUCCESS,("OciEnvCreate failed with error code %hd",result));
// Create error handle.
@@ -64,7 +64,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/shared
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/vtune
)
@@ -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<int>(endingNumberOfBytesAllocated - m_startingNumberOfBytesAllocated), m_description));
m_description = nullptr;
}
}
@@ -38,7 +38,6 @@ private:
char const * m_description;
PerformanceTimer m_performanceTimer;
unsigned long const m_startingNumberOfBytesAllocated;
};
// ======================================================================
@@ -53,7 +53,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedThread/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/fileInterface/include/public
@@ -12,7 +12,7 @@
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
// ======================================================================
@@ -152,7 +152,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedThread/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include
@@ -91,11 +91,11 @@ void ConfigSharedFoundation::install (const Defaults &defaults)
KEY_BOOL(useRemoteDebug, false);
KEY_INT(defaultRemoteDebugPort, 4445);
KEY_BOOL(profilerExpandAllBranches, true);
KEY_BOOL(memoryManagerReportAllocations, true);
KEY_BOOL(memoryManagerReportOnOutOfMemory, true);
KEY_BOOL(profilerExpandAllBranches, false);
KEY_BOOL(memoryManagerReportAllocations, false);
KEY_BOOL(memoryManagerReportOnOutOfMemory, false);
KEY_BOOL(useMemoryBlockManager, true);
KEY_BOOL(useMemoryBlockManager, false);
KEY_BOOL(memoryBlockManagerDebugDumpOnRemove, false);
KEY_INT(fatalCallStackDepth, c_defaultFatalCallStackDepth);
@@ -32,7 +32,7 @@
#include <wchar.h>
#include "sharedFoundation/PlatformGlue.h"
#include "sharedMemoryManager/MemoryManager.h"
// ======================================================================
@@ -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.
@@ -34,7 +34,7 @@
#include "sharedFoundationTypes/FoundationTypes.h"
#include "sharedFoundation/FirstPlatform.h"
#include "sharedMemoryManager/MemoryManager.h"
// ======================================================================
@@ -103,9 +103,9 @@ void ConfigSharedFoundation::install (const Defaults &defaults)
KEY_INT(defaultRemoteDebugPort, 4445);
KEY_BOOL(profilerExpandAllBranches, false);
KEY_BOOL(memoryManagerReportAllocations, true);
KEY_BOOL(memoryManagerReportOnOutOfMemory, true);
KEY_BOOL(useMemoryBlockManager, true);
KEY_BOOL(memoryManagerReportAllocations, false);
KEY_BOOL(memoryManagerReportOnOutOfMemory, false);
KEY_BOOL(useMemoryBlockManager, false);
KEY_BOOL(memoryBlockManagerDebugDumpOnRemove, false);
KEY_INT(fatalCallStackDepth, c_defaultFatalCallStackDepth);
@@ -23,7 +23,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
)
@@ -12,7 +12,7 @@
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
// ======================================================================
@@ -317,7 +317,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedObject/include/public
@@ -12,7 +12,7 @@
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "StringId.h"
// ======================================================================
@@ -33,7 +33,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/fileInterface/include/public
)
@@ -25,7 +25,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
)
add_library(sharedIoWin STATIC
@@ -41,7 +41,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
@@ -121,7 +121,7 @@ include_directories(
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/fileInterface/include/public
@@ -18,7 +18,7 @@ include_directories(
#${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
#${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
#${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
#${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
#
)
add_library(sharedMathArchive STATIC ${EXCLUDE_PROJECT}
@@ -1,8 +0,0 @@
cmake_minimum_required(VERSION 2.8)
project(sharedMemoryManager)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/private)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/public)
add_subdirectory(src)
@@ -1,7 +0,0 @@
#if defined(PLATFORM_WIN32)
#include "../../src/win32/OsMemory.h"
#elif defined(PLATFORM_LINUX)
#include "../../src/linux/OsMemory.h"
#else
#error unsupported platform
#endif
@@ -1 +0,0 @@
#include "../../src/shared/FirstSharedMemoryManager.h"
@@ -1 +0,0 @@
#include "../../src/shared/MemoryManager.h"
@@ -1,7 +0,0 @@
#if defined(PLATFORM_WIN32)
#include "../../src/win32/OsNewDel.h"
#elif defined(PLATFORM_LINUX)
#include "../../src/linux/OsNewDel.h"
#else
#error unsupported platform
#endif
@@ -1,40 +0,0 @@
set(SHARED_SOURCES
shared/FirstSharedMemoryManager.cpp
shared/FirstSharedMemoryManager.h
shared/MemoryManager.cpp
shared/MemoryManager.h
)
if(WIN32)
set(PLATFORM_SOURCES
win32/OsMemory.cpp
win32/OsMemory.h
win32/OsNewDel.cpp
win32/OsNewDel.h
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/win32)
else()
set(PLATFORM_SOURCES
linux/OsMemory.cpp
linux/OsMemory.h
linux/OsNewDel.cpp
linux/OsNewDel.h
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/linux)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/shared
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public
)
add_library(sharedMemoryManager STATIC
${SHARED_SOURCES}
${PLATFORM_SOURCES}
)
@@ -1,40 +0,0 @@
// ======================================================================
//
// OsMemory.cpp
//
// Copyright 2002 Sony Online Entertainment
//
// ======================================================================
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "sharedMemoryManager/OsMemory.h"
// ======================================================================
void OsMemory::install()
{
}
// ----------------------------------------------------------------------
void OsMemory::remove()
{
}
// ----------------------------------------------------------------------
void *OsMemory::commit(void *, size_t bytes)
{
return ::malloc(bytes);
}
// ----------------------------------------------------------------------
bool OsMemory::free(void *addr, size_t)
{
::free(addr);
return true;
}
// ======================================================================
@@ -1,29 +0,0 @@
// ======================================================================
//
// OsMemory.h
//
// Copyright 2002 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_OsMemory_H
#define INCLUDED_OsMemory_H
// ======================================================================
class OsMemory
{
public:
static void install();
static void remove();
static void * reserve(size_t bytes);
static void * commit(void *addr, size_t bytes);
static bool free(void *addr, size_t bytes);
static bool protect(void *addr, size_t bytes, bool allowAccess);
};
// ======================================================================
#endif // INCLUDED_OsMemory_H
@@ -1,93 +0,0 @@
// ======================================================================
//
// OsNewDel.cpp
//
// Copyright 2002 Sony Online Entertainment
//
// ======================================================================
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "sharedMemoryManager/MemoryManager.h"
#include "sharedMemoryManager/OsNewDel.h"
#include <malloc.h>
#include <unistd.h>
#include <sys/mman.h>
static MemoryManager memoryManager __attribute__ ((init_priority (101)));
// ======================================================================
void *operator new(size_t size, MemoryManagerNotALeak)
{
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), false, false);
}
// ----------------------------------------------------------------------
void *operator new(std::size_t size)
{
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), false, true);
}
// ----------------------------------------------------------------------
void *operator new[](size_t size)
{
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), true, true);
}
// ----------------------------------------------------------------------
void *operator new(size_t size, const char *file, int line)
{
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), false, true);
}
// ----------------------------------------------------------------------
void *operator new[](size_t size, const char *file, int line)
{
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), true, true);
}
// ----------------------------------------------------------------------
void operator delete(void *pointer) throw()
{
if (pointer)
MemoryManager::free(pointer, false);
}
// ----------------------------------------------------------------------
void operator delete[](void *pointer) throw()
{
if (pointer)
MemoryManager::free(pointer, true);
}
// ----------------------------------------------------------------------
void operator delete(void *pointer, const char *file, int line) throw()
{
UNREF(file);
UNREF(line);
if (pointer)
MemoryManager::free(pointer, false);
}
// ----------------------------------------------------------------------
void operator delete[](void *pointer, const char *file, int line) throw()
{
UNREF(file);
UNREF(line);
if (pointer)
MemoryManager::free(pointer, true);
}
// ======================================================================
@@ -1,34 +0,0 @@
// ======================================================================
//
// OsNewDel.h
//
// Copyright 2002 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_OsNewDel_H
#define INCLUDED_OsNewDel_H
// ======================================================================
#include <cstddef>
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();
// ======================================================================
#endif // INCLUDED_OsNewDel_H
@@ -1,8 +0,0 @@
// ======================================================================
//
// FirstMemoryManager.cpp
// copyright (c) 2001 Sony Online Entertainment
//
// ======================================================================
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
@@ -1,19 +0,0 @@
// ======================================================================
//
// FirstMemoryManager.h
// copyright (c) 2001 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_FirstMemoryManager_H
#define INCLUDED_FirstMemoryManager_H
// ======================================================================
#include "sharedFoundationTypes/FoundationTypes.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedFoundation/FirstSharedFoundation.h"
// ======================================================================
#endif
File diff suppressed because it is too large Load Diff
@@ -1,84 +0,0 @@
// ======================================================================
//
// MemoryManager.h
// Portions copyright 1998 Bootprint Entertainment
// Portions copyright 2002 Sony Online Entertainment
// All Rights Reserved
//
// ======================================================================
#ifndef INCLUDED_MemoryManager_H
#define INCLUDED_MemoryManager_H
// ======================================================================
#include "sharedDebug/DebugHelp.h"
// ======================================================================
#include <new>
#include "sharedMemoryManager/OsNewDel.h"
// ======================================================================
// Memory manager class.
//
// This class API is multi-thread safe.
//
// This class provides extensive debugging features for applications, including
// overwrite guard bands, initialize pattern fills, free pattern fills, and
// memory tracking.
class MemoryManager
{
public:
MemoryManager();
~MemoryManager();
static void setLimit(int megabytes, bool hardLimit, bool preallocate);
static int getLimit();
static bool isHardLimit();
static void registerDebugFlags();
static void debugReport();
static void debugReportMap();
static bool reportToFile(const char * fileName, bool leak);
static int getCurrentNumberOfAllocations();
static unsigned long getCurrentNumberOfBytesAllocated(const int processId = 0);
static unsigned long getCurrentNumberOfBytesAllocatedNoLeakTest();
static int getMaximumNumberOfAllocations();
static unsigned long getMaximumNumberOfBytesAllocated();
static int getSystemMemoryAllocatedMegabytes();
#ifndef _WIN32
static int getProcessVmSizeKBytes(const int processId = 0);
#endif
static DLLEXPORT void *allocate(size_t size, uint32 owner, bool array, bool leakTest);
static DLLEXPORT void free(void *pointer, bool array);
static DLLEXPORT void own(void *pointer);
static void * reallocate(void *userPointer, size_t newSize);
static void verify(bool guardPatterns, bool freePatterns);
static void setReportAllocations(bool reportAllocations);
static void report();
private:
// disabled
MemoryManager(MemoryManager const &);
MemoryManager &operator =(MemoryManager const &);
};
// ======================================================================
#ifdef _DEBUG
#define MEM_OWN(a) MemoryManager::own(a)
#else
#define MEM_OWN(a) UNREF(a)
#endif
// ======================================================================
#endif
@@ -1,56 +0,0 @@
// ======================================================================
//
// OsMemory.cpp
//
// Copyright 2002 Sony Online Entertainment
//
// ======================================================================
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "sharedMemoryManager/OsMemory.h"
// ======================================================================
void OsMemory::install()
{
}
// ----------------------------------------------------------------------
void OsMemory::remove()
{
}
// ----------------------------------------------------------------------
void *OsMemory::reserve(size_t bytes)
{
return VirtualAlloc(0, bytes, MEM_RESERVE, PAGE_READWRITE);
}
// ----------------------------------------------------------------------
void *OsMemory::commit(void *addr, size_t bytes)
{
return VirtualAlloc(addr, bytes, MEM_COMMIT, PAGE_READWRITE);
}
// ----------------------------------------------------------------------
bool OsMemory::free(void *addr, size_t bytes)
{
UNREF(bytes);
return VirtualFree(addr, 0, MEM_RELEASE) ? true : false;
}
// ----------------------------------------------------------------------
bool OsMemory::protect(void *addr, size_t bytes, bool allowAccess)
{
DWORD old;
BOOL result = VirtualProtect(addr, bytes, allowAccess ? PAGE_READWRITE : PAGE_NOACCESS, &old);
return result ? true : false;
}
// ======================================================================
@@ -1,29 +0,0 @@
// ======================================================================
//
// OsMemory.h
//
// Copyright 2002 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_OsMemory_H
#define INCLUDED_OsMemory_H
// ======================================================================
class OsMemory
{
public:
static void install();
static void remove();
static void * reserve(size_t bytes);
static void * commit(void *addr, size_t bytes);
static bool free(void *addr, size_t bytes);
static bool protect(void *addr, size_t bytes, bool allowAccess);
};
// ======================================================================
#endif INCLUDED_OsMemory_H

Some files were not shown because too many files have changed in this diff Show More