mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-10-01 16:13:19 -04:00
tidies some things up and removes SOE memory manager overriding
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
*/
|
||||
// ======================================================================
|
||||
|
||||
|
||||
@@ -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();
|
||||
*/
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
@@ -1349,7 +1349,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize)
|
||||
|
||||
if (newSize <= static_cast<size_t>(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;
|
||||
}
|
||||
|
||||
@@ -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 ())
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -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<char const *>(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<int>(postDomBytesAllocated - preDomBytesAllocated)));
|
||||
#endif
|
||||
|
||||
// Release initial file contents buffer.
|
||||
delete [] fileContents;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user