mirror of
https://bitbucket.org/seefoe/src.git
synced 2026-07-30 00:15:46 -04:00
Merge branch 'newjava' into testing
This commit is contained in:
@@ -103,6 +103,10 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
|
||||
${_JAVA_HOME}/jre/bin/classic
|
||||
${_JAVA_HOME}/lib
|
||||
${_JAVA_HOME}
|
||||
/opt/java17/jre/lib/i386
|
||||
/opt/java17/jre/lib
|
||||
/opt/java17/jre
|
||||
/opt/java17/lib
|
||||
/usr/java/jre/lib/i386
|
||||
/usr/java/jre/lib
|
||||
/usr/lib
|
||||
@@ -152,6 +156,8 @@ set(JAVA_AWT_INCLUDE_DIRECTORIES
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
|
||||
${_JAVA_HOME}/include
|
||||
/opt/java17/include
|
||||
/opt/java17/jre/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/usr/lib/java/include
|
||||
|
||||
@@ -492,7 +492,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const
|
||||
{
|
||||
if (msg.getFinished())
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Cluster %s is ready for players.\n",cle->m_clusterName.c_str()));
|
||||
REPORT_LOG(true, ("Cluster %s is ready for players.\n",cle->m_clusterName.c_str()));
|
||||
if (!cle->m_readyForPlayers)
|
||||
{
|
||||
cle->m_readyForPlayers = true;
|
||||
@@ -501,7 +501,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Cluster %s is not ready for players.\n",cle->m_clusterName.c_str()));
|
||||
REPORT_LOG(true, ("Cluster %s is not ready for players.\n",cle->m_clusterName.c_str()));
|
||||
if (cle->m_readyForPlayers)
|
||||
{
|
||||
cle->m_readyForPlayers = false;
|
||||
|
||||
@@ -74,7 +74,7 @@ void ConfigServerDatabase::install(void)
|
||||
KEY_BOOL (enableLoadLocks, true);
|
||||
KEY_INT (databaseReconnectTime, 0);
|
||||
KEY_BOOL (logChunkLoading,false);
|
||||
KEY_BOOL (useMemoryManagerForOCI,true);
|
||||
KEY_BOOL (useMemoryManagerForOCI,false);
|
||||
KEY_INT (maxCharactersPerLoadRequest,10);
|
||||
KEY_INT (maxChunksPerLoadRequest,200);
|
||||
KEY_FLOAT (maxLoadStartDelay,300.0f);
|
||||
|
||||
@@ -439,34 +439,6 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
|
||||
}
|
||||
result += Unicode::narrowToWide(pid.getValueString());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
else if (isAbbrev( argv[0], "memUsage"))
|
||||
{
|
||||
char text[256];
|
||||
sprintf(text, "Bytes: %lu Allocations: %d\n", MemoryManager::getCurrentNumberOfBytesAllocated(), MemoryManager::getCurrentNumberOfAllocations());
|
||||
|
||||
result += Unicode::narrowToWide(text);
|
||||
result += getErrorMessage (argv[0], ERR_SUCCESS);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
else if (isAbbrev( argv[0], "memoryReport"))
|
||||
{
|
||||
MemoryManager::report();
|
||||
result += getErrorMessage (argv[0], ERR_SUCCESS);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
else if (isAbbrev( argv[0], "dumpMemToFile"))
|
||||
{
|
||||
std::string fileName(Unicode::wideToNarrow(argv[1]));
|
||||
std::string leakStr(Unicode::wideToNarrow(argv[2]));
|
||||
bool leak = (leakStr == "true" || leakStr == "1");
|
||||
|
||||
MemoryManager::reportToFile(fileName.c_str(), leak);
|
||||
result += getErrorMessage (argv[0], ERR_SUCCESS);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
else if (isAbbrev( argv[0], "clock"))
|
||||
|
||||
@@ -2470,7 +2470,7 @@ NetworkId AICreatureController::getUnarmedWeapon()
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::getUnarmedWeapon() Unable to find a default weapon for (%s)", getDebugInformation().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::getUnarmedWeapon() Unable to find a default weapon for (%s)", getDebugInformation().c_str()));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -67,7 +67,7 @@ void ConfigServerGame::install(void)
|
||||
KEY_BOOL (profileScripts, false);
|
||||
KEY_BOOL (crashOnScriptError, false);
|
||||
KEY_BOOL (compileScripts, false);
|
||||
KEY_BOOL (trapScriptCrashes, true);
|
||||
KEY_BOOL (trapScriptCrashes, false); //this seems to horrifyingly crash java 7/8 sometimes if not always
|
||||
KEY_INT (scriptWatcherWarnTime, 5000);
|
||||
KEY_INT (scriptWatcherInterruptTime, 5000);
|
||||
KEY_INT (scriptStackErrorLimit, 35);
|
||||
@@ -103,6 +103,7 @@ void ConfigServerGame::install(void)
|
||||
KEY_INT (jediUpdateLocationTimeSeconds, 60 * 5);
|
||||
KEY_STRING (planetObjectTemplate, "object/planet/planet.iff");
|
||||
KEY_BOOL (javaConsoleDebugMessages, false);
|
||||
KEY_BOOL (javaUseXcheck, false);
|
||||
KEY_BOOL (useVerboseJava, false);
|
||||
KEY_BOOL (logJavaGc, false);
|
||||
KEY_INT (javaLocalRefLimit, 16);
|
||||
|
||||
@@ -110,6 +110,7 @@ class ConfigServerGame
|
||||
int universeCheckFrequencySeconds; // how often to scan the resource tree for things that need to be spawned
|
||||
|
||||
bool javaConsoleDebugMessages;
|
||||
bool javaUseXcheck;
|
||||
bool useVerboseJava;
|
||||
bool logJavaGc;
|
||||
int javaLocalRefLimit;
|
||||
@@ -670,6 +671,7 @@ class ConfigServerGame
|
||||
static const int getUniverseCheckFrequencySeconds(void);
|
||||
|
||||
static const bool getJavaConsoleDebugMessages (void);
|
||||
static const bool getUseJavaXcheck (void);
|
||||
static const bool getUseVerboseJava (void);
|
||||
static const bool getLogJavaGc (void);
|
||||
|
||||
@@ -1476,6 +1478,13 @@ inline const bool ConfigServerGame::getJavaConsoleDebugMessages()
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigServerGame::getUseJavaXcheck()
|
||||
{
|
||||
return data->javaUseXcheck;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigServerGame::getUseVerboseJava(void)
|
||||
{
|
||||
return data->useVerboseJava;
|
||||
|
||||
@@ -902,7 +902,7 @@ LocalRef::LocalRef(jobject src) :
|
||||
|
||||
LocalRef::~LocalRef()
|
||||
{
|
||||
if (m_ref != 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteLocalRef(m_ref);
|
||||
m_ref = 0;
|
||||
}
|
||||
@@ -917,7 +917,7 @@ LocalArrayRef::LocalArrayRef(jarray src) :
|
||||
|
||||
LocalArrayRef::~LocalArrayRef()
|
||||
{
|
||||
if (m_ref != 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteLocalRef(m_ref);
|
||||
m_ref = 0;
|
||||
}
|
||||
@@ -932,7 +932,7 @@ LocalObjectArrayRef::LocalObjectArrayRef(jobjectArray src) :
|
||||
|
||||
LocalObjectArrayRef::~LocalObjectArrayRef()
|
||||
{
|
||||
if (m_ref != 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteLocalRef(m_ref);
|
||||
m_ref = 0;
|
||||
}
|
||||
@@ -1008,7 +1008,7 @@ GlobalRef::GlobalRef(const LocalRefParam & src) :
|
||||
|
||||
GlobalRef::~GlobalRef()
|
||||
{
|
||||
if (m_ref != 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteGlobalRef(m_ref);
|
||||
m_ref = 0;
|
||||
}
|
||||
@@ -1025,7 +1025,7 @@ GlobalArrayRef::GlobalArrayRef(const LocalObjectArrayRefParam & src) :
|
||||
|
||||
GlobalArrayRef::~GlobalArrayRef()
|
||||
{
|
||||
if (m_ref != 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteGlobalRef(m_ref);
|
||||
m_ref = 0;
|
||||
}
|
||||
@@ -1048,7 +1048,7 @@ JavaStringParam::~JavaStringParam()
|
||||
|
||||
int JavaStringParam::fillBuffer(char * buffer, int size) const
|
||||
{
|
||||
if (m_ref != 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref > 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr)
|
||||
{
|
||||
// Get the number of storage bytes required to convert this Java string into a UTF-8 string.
|
||||
// Include the terminating nullptr byte in the required buffer size.
|
||||
@@ -1093,7 +1093,7 @@ JavaString::JavaString(const Unicode::String & src) :
|
||||
|
||||
JavaString::~JavaString()
|
||||
{
|
||||
if (m_ref != 0 && JavaLibrary::getEnv() != nullptr)
|
||||
if (m_ref > 0 && JavaLibrary::getEnv() != nullptr)
|
||||
JavaLibrary::getEnv()->DeleteLocalRef(m_ref);
|
||||
m_ref = 0;
|
||||
}
|
||||
|
||||
@@ -50,27 +50,14 @@ using namespace JNIWrappersNamespace;
|
||||
#error Unsupported platform
|
||||
#endif
|
||||
|
||||
#if !defined(JNI_IBM_JAVA) && defined(WIN32)
|
||||
//-- Justin Randall [1/21/2003 4:43:15 PM] --
|
||||
// The scripting system simply will not work properly with
|
||||
// our linux servers running the ibm java vm if the win32
|
||||
// server is not also using that vm. There are serialization
|
||||
// issues that render the game useless. Please do not
|
||||
// change this until the broken interaction between various
|
||||
// VM's has been rectified!
|
||||
//#error Unsupported Java VM
|
||||
#endif//JNI_IBM_JAVA
|
||||
|
||||
//#undef JNI_IBM_JAVA
|
||||
|
||||
#ifdef linux
|
||||
// shared library includes
|
||||
#include <dlfcn.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifndef JNI_VERSION_1_2
|
||||
#error JNI version 1.2 or better only!
|
||||
#ifndef JNI_VERSION_1_4
|
||||
#error JNI version 1.4 or better only!
|
||||
#endif
|
||||
|
||||
//========================================================================
|
||||
@@ -771,7 +758,7 @@ void JavaLibrary::throwScriptException(char const * const format, ...)
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
|
||||
throwScriptException(format, va);
|
||||
throwScriptException(format, va);
|
||||
|
||||
va_end(va);
|
||||
}
|
||||
@@ -879,7 +866,7 @@ void JavaLibrary::fatalHandler(int signum)
|
||||
else
|
||||
{
|
||||
// destroy Java threads
|
||||
// @note apathy - this pthread method is not in later versions of glibc
|
||||
// this pthread method is not in later versions of glibc as the kernel should handle the kill
|
||||
//pthread_kill_other_threads_np();
|
||||
ms_instance = nullptr;
|
||||
ms_env = nullptr;
|
||||
@@ -1026,16 +1013,17 @@ void JavaLibrary::initializeJavaThread()
|
||||
if (javaVMName == nullptr || (
|
||||
strcmp(javaVMName, "none") != 0 &&
|
||||
strcmp(javaVMName, "ibm") != 0 &&
|
||||
strcmp(javaVMName, "sun") != 0))
|
||||
strcmp(javaVMName, "sun") != 0 &&
|
||||
strcmp(javaVMName, "oracle") != 0))
|
||||
{
|
||||
FATAL(true, ("[ServerGame] javaVMName not defined. Valid values are: "
|
||||
"none, ibm, or sun"));
|
||||
"none, ibm, oracle, or sun"));
|
||||
}
|
||||
else if (strcmp(javaVMName, "ibm") == 0)
|
||||
{
|
||||
ms_javaVmType = JV_ibm;
|
||||
}
|
||||
else if (strcmp(javaVMName, "sun") == 0)
|
||||
else if (strcmp(javaVMName, "sun") == 0 || strcmp(javaVMName, "oracle") == 0)
|
||||
{
|
||||
ms_javaVmType = JV_sun;
|
||||
}
|
||||
@@ -1146,11 +1134,8 @@ void JavaLibrary::initializeJavaThread()
|
||||
|
||||
// set up the args to initialize the jvm
|
||||
std::string classPath = "-Djava.class.path=";
|
||||
// classPath += PATH_SEPARATOR;
|
||||
classPath += ConfigServerGame::getScriptPath();
|
||||
|
||||
// DEBUG_REPORT_LOG(true, ("Java class path = %s\n", classPath.c_str()));
|
||||
|
||||
JavaVMInitArgs vm_args;
|
||||
JavaVMOption tempOption = {nullptr, nullptr};
|
||||
std::vector<JavaVMOption> options;
|
||||
@@ -1158,11 +1143,6 @@ void JavaLibrary::initializeJavaThread()
|
||||
|
||||
UNREF(jdwpBuffer);
|
||||
|
||||
// classPath += PATH_SEPARATOR;
|
||||
// classPath += "/home/sjakab/temp/OptimizeitSuiteDemo/lib/optit.jar";
|
||||
// tempOption.optionString = "-Xnoclassgc";
|
||||
// options.push_back(tempOption);
|
||||
|
||||
if (ConfigServerScript::hasJavaOptions())
|
||||
{
|
||||
int const numberOfJavaOptions = ConfigServerScript::getNumberOfJavaOptions();
|
||||
@@ -1175,44 +1155,53 @@ void JavaLibrary::initializeJavaThread()
|
||||
}
|
||||
else
|
||||
{
|
||||
// use options derived from config file settings
|
||||
|
||||
// set up memory requirements
|
||||
tempOption.optionString = "-Xms128m";
|
||||
options.push_back(tempOption);
|
||||
tempOption.optionString = "-Xmx512m";
|
||||
options.push_back(tempOption);
|
||||
tempOption.optionString = "-Xss768k";
|
||||
options.push_back(tempOption);
|
||||
if (ms_javaVmType == JV_ibm)
|
||||
{
|
||||
tempOption.optionString = "-Xoss768k";
|
||||
options.push_back(tempOption);
|
||||
}
|
||||
options.push_back(tempOption);
|
||||
|
||||
if (ms_javaVmType == JV_ibm)
|
||||
if (ms_javaVmType == JV_sun)
|
||||
{
|
||||
tempOption.optionString = "-Xcheck:jni";
|
||||
options.push_back(tempOption);
|
||||
tempOption.optionString = "-Xcheck:nabounds";
|
||||
options.push_back(tempOption);
|
||||
|
||||
// java 1.8 and higher uses metaspace...which is apparently unlimited by default
|
||||
#if defined(JNI_VERSION_1_8) || defined(JNI_VERSION_1_9)
|
||||
tempOption.optionString = "-XX:MetaspaceSize=64m";
|
||||
options.push_back(tempOption);
|
||||
#endif
|
||||
|
||||
tempOption.optionString = "-Xrs";
|
||||
options.push_back(tempOption);
|
||||
#ifndef WIN32
|
||||
tempOption.optionString = "-Xgcpolicy:optavgpause";
|
||||
options.push_back(tempOption);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (ConfigServerGame::getUseJavaXcheck())
|
||||
{
|
||||
tempOption.optionString = "-Xcheck:jni";
|
||||
options.push_back(tempOption);
|
||||
}
|
||||
|
||||
if (ConfigServerGame::getCompileScripts())
|
||||
{
|
||||
tempOption.optionString = "-Xint";
|
||||
options.push_back(tempOption);
|
||||
}
|
||||
tempOption.optionString = "-Xincgc";
|
||||
options.push_back(tempOption);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempOption.optionString = "-Xoss768k";
|
||||
options.push_back(tempOption);
|
||||
tempOption.optionString = "-Xcheck:jni";
|
||||
options.push_back(tempOption);
|
||||
tempOption.optionString = "-Xcheck:nabounds";
|
||||
options.push_back(tempOption);
|
||||
tempOption.optionString = "-Xrs";
|
||||
options.push_back(tempOption);
|
||||
#ifndef WIN32
|
||||
tempOption.optionString = "-Xgcpolicy:optavgpause";
|
||||
options.push_back(tempOption);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ConfigServerGame::getUseVerboseJava())
|
||||
{
|
||||
@@ -1224,22 +1213,12 @@ void JavaLibrary::initializeJavaThread()
|
||||
options.push_back(tempOption);
|
||||
}
|
||||
|
||||
#ifdef JNI_VERSION_1_4
|
||||
if ((!ms_javaVmType) == JV_ibm)
|
||||
{
|
||||
tempOption.optionString = "-Xrs";
|
||||
options.push_back(tempOption);
|
||||
tempOption.optionString = "-Xcheck:jni";
|
||||
options.push_back(tempOption);
|
||||
}
|
||||
if (ConfigServerGame::getLogJavaGc())
|
||||
{
|
||||
tempOption.optionString = "-Xloggc:javagc.log";
|
||||
options.push_back(tempOption);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef REMOTE_DEBUG_ON
|
||||
char *jdwpBuffer = nullptr;
|
||||
if (ConfigServerGame::getUseRemoteDebugJava())
|
||||
@@ -1253,11 +1232,13 @@ void JavaLibrary::initializeJavaThread()
|
||||
}
|
||||
tempOption.optionString = "-Xdebug";
|
||||
options.push_back(tempOption);
|
||||
|
||||
// we need to copy the -Xrunjdwp parameter into a char buffer due to a bug
|
||||
// in the Java VM
|
||||
const char * jdwpString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n";
|
||||
jdwpBuffer = new char[strlen(jdwpString) + 32];
|
||||
strcpy(jdwpBuffer, jdwpString);
|
||||
|
||||
if (ConfigServerGame::getJavaDebugPort()[0] == '\0')
|
||||
{
|
||||
strcat(jdwpBuffer, ",address=");
|
||||
@@ -1288,14 +1269,47 @@ void JavaLibrary::initializeJavaThread()
|
||||
tempOption.optionString = const_cast<char *>(classPath.c_str());
|
||||
options.push_back(tempOption);
|
||||
|
||||
#ifdef JNI_VERSION_1_4
|
||||
vm_args.version = JNI_VERSION_1_4;
|
||||
#else
|
||||
vm_args.version = JNI_VERSION_1_2;
|
||||
// TODO: this really sucks as the jvm won't start without the param
|
||||
// there's a dynamic method but requires the jvm to already be running, wtf?
|
||||
#ifdef JNI_VERSION_1_9
|
||||
vm_args.version = JNI_VERSION_1_9;
|
||||
#define JNIVERSET = 1
|
||||
#endif
|
||||
|
||||
#if !defined(JNIVERSET) && defined(JNI_VERSION_1_8)
|
||||
vm_args.version = JNI_VERSION_1_8;
|
||||
#define JNIVERSET = 1
|
||||
#endif
|
||||
|
||||
#if !defined(JNIVERSET) && defined(JNI_VERSION_1_7)
|
||||
vm_args.version = JNI_VERSION_1_7;
|
||||
#define JNIVERSET = 1
|
||||
#endif
|
||||
|
||||
#if !defined(JNIVERSET) && defined(JNI_VERSION_1_6)
|
||||
vm_args.version = JNI_VERSION_1_6;
|
||||
#define JNIVERSET = 1
|
||||
#endif
|
||||
|
||||
#if !defined(JNIVERSET) && defined(JNI_VERSION_1_5)
|
||||
vm_args.version = JNI_VERSION_1_5;
|
||||
#define JNIVERSET = 1
|
||||
#endif
|
||||
|
||||
#if !defined(JNIVERSET) && defined(JNI_VERSION_1_4)
|
||||
vm_args.version = JNI_VERSION_1_4;
|
||||
#define JNIVERSET = 1
|
||||
#endif
|
||||
|
||||
#ifdef JNIVERSET
|
||||
#undef JNIVERSET
|
||||
#else
|
||||
#error JNI version not found/set!
|
||||
#endif
|
||||
|
||||
vm_args.options = &options[0];
|
||||
vm_args.nOptions = options.size();
|
||||
vm_args.ignoreUnrecognized = JNI_FALSE;
|
||||
vm_args.ignoreUnrecognized = JNI_TRUE; // ok let's ignore whatever isn't understood instead of crashing like a loser
|
||||
|
||||
// create the JVM
|
||||
JNIEnv * env = nullptr;
|
||||
@@ -1317,16 +1331,14 @@ void JavaLibrary::initializeJavaThread()
|
||||
}
|
||||
ms_loaded = 1;
|
||||
|
||||
#ifdef linux
|
||||
if (ConfigServerGame::getTrapScriptCrashes())
|
||||
{
|
||||
{
|
||||
//set up signal handler for fatals in linux
|
||||
OurSa.sa_handler = fatalHandler;
|
||||
sigemptyset(&OurSa.sa_mask);
|
||||
OurSa.sa_flags = 0;
|
||||
IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, &JavaSa));
|
||||
}
|
||||
#endif
|
||||
|
||||
// wait until the main thread tells us to shutdown
|
||||
ms_shutdownJava->wait();
|
||||
@@ -1335,13 +1347,11 @@ void JavaLibrary::initializeJavaThread()
|
||||
IGNORE_RETURN(ms_jvm->DestroyJavaVM());
|
||||
ms_jvm = nullptr;
|
||||
|
||||
#ifdef linux
|
||||
if (ConfigServerGame::getTrapScriptCrashes())
|
||||
{
|
||||
// restore the default signal handler
|
||||
IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
IGNORE_RETURN(FreeLibrary(static_cast<HMODULE>(libHandle)));
|
||||
@@ -5237,10 +5247,10 @@ bool JavaLibrary::unpackDictionary(const std::vector<int8> & packedData,
|
||||
if (!packedData.empty())
|
||||
{
|
||||
// get the crc from the data
|
||||
// uint32 crc = 0;
|
||||
uint32 crc = 0;
|
||||
int dataLen = packedData.size();
|
||||
const int8 * data = &packedData[0];
|
||||
/*
|
||||
|
||||
std::vector<int8>::const_iterator result = std::find(packedData.begin(),
|
||||
packedData.end(), '*');
|
||||
if (result != packedData.end())
|
||||
@@ -5269,7 +5279,7 @@ bool JavaLibrary::unpackDictionary(const std::vector<int8> & packedData,
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (data != nullptr && *data != '\0')
|
||||
{
|
||||
LocalByteArrayRefPtr jdata = createNewByteArray(dataLen);
|
||||
|
||||
@@ -34,66 +34,28 @@
|
||||
#include <fcntl.h>
|
||||
#include <new>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DISABLE_MEMORY_MANAGER 0
|
||||
#else
|
||||
#define DISABLE_MEMORY_MANAGER 0
|
||||
#endif
|
||||
// the below seems to bare minimum cause the DB process to segfault
|
||||
// too bad, if we weren't using an omnibus mem manager we could potentially maximize usage
|
||||
#define DISABLE_MEMORY_MANAGER 1
|
||||
|
||||
//lint -e826 // Suspicious pointer-to-pointer conversion (area too small)
|
||||
|
||||
#if !DISABLE_MEMORY_MANAGER
|
||||
|
||||
// ======================================================================
|
||||
//
|
||||
|
||||
// this flag is different than above, as it doesn't fully disable the manager, only a few pieces
|
||||
// including the destructor for some reason
|
||||
#define DISABLED 0
|
||||
|
||||
#if PRODUCTION
|
||||
|
||||
#define DO_TRACK 0
|
||||
#define DO_SCALAR 0
|
||||
#define DO_GUARDS 0
|
||||
#define DO_INITIALIZE_FILLS 0
|
||||
#define DO_FREE_FILLS 0
|
||||
|
||||
#else
|
||||
|
||||
#if DEBUG_LEVEL == DEBUG_LEVEL_DEBUG
|
||||
|
||||
#define DO_TRACK 1
|
||||
#define DO_SCALAR 1
|
||||
#define DO_GUARDS 1
|
||||
#define DO_INITIALIZE_FILLS 1
|
||||
#define DO_FREE_FILLS 1
|
||||
|
||||
#elif DEBUG_LEVEL == DEBUG_LEVEL_OPTIMIZED
|
||||
|
||||
#define DO_TRACK 1
|
||||
#define DO_SCALAR 1
|
||||
#define DO_GUARDS 1
|
||||
#define DO_INITIALIZE_FILLS 1
|
||||
#define DO_FREE_FILLS 1
|
||||
|
||||
#elif DEBUG_LEVEL == DEBUG_LEVEL_RELEASE
|
||||
|
||||
#define DO_TRACK 0
|
||||
#define DO_SCALAR 0
|
||||
#define DO_GUARDS 0
|
||||
#define DO_INITIALIZE_FILLS 0
|
||||
#define DO_FREE_FILLS 0
|
||||
|
||||
#else
|
||||
|
||||
#error unknown DEBUG_LEVEL
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
#undef DO_TRACK
|
||||
#define DO_TRACK 5
|
||||
#endif
|
||||
// removed all the debug cases for these as these seem to cause problems
|
||||
// recent modifications force the mem manager to always behave in production mode
|
||||
// other areas will remain unaffected
|
||||
#define DO_TRACK 0
|
||||
#define DO_SCALAR 0
|
||||
#define DO_GUARDS 0
|
||||
#define DO_INITIALIZE_FILLS 0
|
||||
#define DO_FREE_FILLS 0
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -159,7 +121,7 @@ namespace MemoryManagerNamespace
|
||||
bool m_array:1;
|
||||
#endif
|
||||
#if DO_TRACK
|
||||
bool m_leakTest:1;
|
||||
bool m_leakTest:0;
|
||||
#endif
|
||||
#if DO_TRACK || DO_GUARDS
|
||||
unsigned int m_requestedSize:cms_requestedSizeBits;
|
||||
@@ -261,16 +223,13 @@ namespace MemoryManagerNamespace
|
||||
int ms_numberOfSystemAllocations;
|
||||
int ms_systemMemoryAllocatedMegabytes;
|
||||
bool ms_reportAllocations;
|
||||
// bool ms_logEachAlloc;
|
||||
|
||||
#if PRODUCTION == 0
|
||||
PixCounter::ResetInteger ms_allocationsPerFrame;
|
||||
PixCounter::ResetInteger ms_bytesAllocatedPerFrame;
|
||||
PixCounter::ResetInteger ms_freesPerFrame;
|
||||
PixCounter::ResetInteger ms_bytesFreedPerFrame;
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
PixCounter::ResetInteger ms_allocationsPerFrame;
|
||||
PixCounter::ResetInteger ms_bytesAllocatedPerFrame;
|
||||
PixCounter::ResetInteger ms_freesPerFrame;
|
||||
PixCounter::ResetInteger ms_bytesFreedPerFrame;
|
||||
|
||||
bool ms_debugReportFlag;
|
||||
bool ms_debugReportMapFlag;
|
||||
bool ms_debugReportAllocations;
|
||||
@@ -663,13 +622,6 @@ MemoryManager::~MemoryManager()
|
||||
return;
|
||||
#else
|
||||
|
||||
#if PRODUCTION == 0
|
||||
ms_allocationsPerFrame.disable();
|
||||
ms_bytesAllocatedPerFrame.disable();
|
||||
ms_freesPerFrame.disable();
|
||||
ms_bytesFreedPerFrame.disable();
|
||||
#endif
|
||||
|
||||
DEBUG_FATAL(!ms_installed, ("not installed"));
|
||||
|
||||
ms_criticalSection->enter();
|
||||
@@ -817,13 +769,6 @@ void MemoryManager::setReportAllocations(bool reportAllocations)
|
||||
|
||||
void MemoryManager::registerDebugFlags()
|
||||
{
|
||||
#if PRODUCTION == 0
|
||||
ms_allocationsPerFrame.bindToCounter("MemoryManagerAllocateCount");
|
||||
ms_bytesAllocatedPerFrame.bindToCounter("MemoryManagerAllocateBytes");
|
||||
ms_freesPerFrame.bindToCounter("MemoryManagerFreeCount");
|
||||
ms_bytesFreedPerFrame.bindToCounter("MemoryManagerFreeBytes");
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugFlags::registerFlag(ms_debugReportFlag, "SharedMemoryManager", "reportMemory", debugReport);
|
||||
DebugFlags::registerFlag(ms_debugReportMapFlag, "SharedMemoryManager", "reportMemoryMap", debugReportMap);
|
||||
@@ -1206,11 +1151,6 @@ void * MemoryManager::allocate(size_t size, uint32 owner, bool array, bool leakT
|
||||
|
||||
DEBUG_FATAL(!ms_installed, ("not installed"));
|
||||
|
||||
#if PRODUCTION == 0
|
||||
++ms_allocationsPerFrame;
|
||||
ms_bytesAllocatedPerFrame += size;
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (ms_debugProfileAllocate)
|
||||
PROFILER_BLOCK_ENTER(ms_allocateProfilerBlock);
|
||||
@@ -1476,12 +1416,9 @@ void MemoryManager::free(void * userPointer, bool array)
|
||||
DEBUG_FATAL(allocatedBlock->isFree(), ("Freeing already free block %p", userPointer));
|
||||
#endif
|
||||
|
||||
#if PRODUCTION == 0
|
||||
++ms_freesPerFrame;
|
||||
#if DO_TRACK
|
||||
ms_bytesFreedPerFrame += allocatedBlock->getRequestedSize();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if DO_GUARDS
|
||||
{
|
||||
@@ -2102,7 +2039,7 @@ void MemoryManager::setLimit(int, bool, bool)
|
||||
|
||||
int MemoryManager::getLimit()
|
||||
{
|
||||
return 768;
|
||||
return 3072;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
+4
-4
@@ -184,11 +184,11 @@ inline typename AutoDeltaSet<ValueType, ObjectType>::const_iterator AutoDeltaSet
|
||||
m_commands.push_back(c);
|
||||
++m_baselineCommandCount;
|
||||
|
||||
// @note apathy - hack to convert from const_iterator to iterator as requried by STLPort
|
||||
// hack to convert from const_iterator to iterator as required by std libs
|
||||
typename SetType::iterator tmp(m_set.begin());
|
||||
std::advance(tmp, std::distance<const_iterator>(tmp, i));
|
||||
i++;
|
||||
m_set.erase(tmp);
|
||||
std::advance(tmp, std::distance<const_iterator>(tmp, i));
|
||||
i++;
|
||||
m_set.erase(tmp);
|
||||
|
||||
touch();
|
||||
onErase(c.value);
|
||||
|
||||
Reference in New Issue
Block a user