logic: removed "JVM Maximum Memory" setting from preferences

This commit is contained in:
mlangkabel
2019-10-18 13:05:27 +02:00
committed by Eberhard Graether
parent 942eb219eb
commit 0587d54172
5 changed files with 1 additions and 69 deletions
-10
View File
@@ -385,16 +385,6 @@ void ApplicationSettings::setHasPrefilledJavaPath(bool v)
setValue<bool>("indexing/java/has_prefilled_java_path", v);
}
int ApplicationSettings::getJavaMaximumMemory() const
{
return getValue<int>("indexing/java/java_maximum_memory", -1);
}
void ApplicationSettings::setJavaMaximumMemory(int size)
{
setValue<int>("indexing/java/java_maximum_memory", size);
}
std::vector<FilePath> ApplicationSettings::getJreSystemLibraryPaths() const
{
return getPathValues("indexing/java/jre_system_library_paths/jre_system_library_path");
@@ -107,8 +107,6 @@ void CommandlineCommandConfig::setup()
"Enable additional log of abstract syntax tree during the indexing. <true/false> WARNINIG Slows down "
"indexing speed")
("jvm-path,j", po::value<std::string>(), "Path to the location of the jvm library")
("jvm-max-memory,M", po::value<int>(),
"Set the maximum amount of memory for the JVM indexer(-1 for using the JVM default settings)")
("maven-path,m", po::value<std::string>(), "Path to the maven binary")
("jre-system-library-paths,J", po::value<std::vector<std::string>>(),
"paths to the jars of the JRE system library. "
@@ -167,7 +165,6 @@ CommandlineCommand::ReturnStatus CommandlineCommandConfig::parse(std::vector<std
<< "\n logging-enabled: " << settings->getLoggingEnabled()
<< "\n verbose-indexer-logging-enabled: " << settings->getVerboseIndexerLoggingEnabled()
<< "\n jvm-path: " << settings->getJavaPath().str()
<< "\n jvm-max-memory: " << settings->getJavaMaximumMemory()
<< "\n maven-path: " << settings->getMavenPath().str();
printVector("global-header-search-paths", settings->getHeaderSearchPaths());
printVector("global-framework-search-paths", settings->getFrameworkSearchPaths());
@@ -185,7 +182,6 @@ CommandlineCommand::ReturnStatus CommandlineCommandConfig::parse(std::vector<std
);
parseAndSetValue(&ApplicationSettings::setIndexerThreadCount, "indexer-threads", settings, vm);
parseAndSetValue(&ApplicationSettings::setJavaMaximumMemory, "jvm-max-memory", settings, vm);
parseAndSetValue(&ApplicationSettings::setMavenPath, "maven-path", settings, vm);
parseAndSetValue(&ApplicationSettings::setJavaPath, "jvm-path", settings, vm);
@@ -317,24 +317,6 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
addJavaPathDetection(layout, row);
}
if (QSysInfo::windowsVersion() != QSysInfo::WV_WINDOWS10)
{
// jvm max memory
m_jvmMaximumMemory = addLineEdit(
"JVM Maximum Memory",
"<p>Specify the maximum amount of memory that will be allocated by the indexer's JVM (values are in MB). Set "
"this value to -1 to use the JVM's default setting.</p>"
"<p><b>Warning</b>: You may experience a sudden slowdown during the course of indexing when setting this value "
"too low. This may also happen when using the JVM's default setting.</p>",
layout, row
);
layout->setRowMinimumHeight(row - 1, 30);
}
else
{
m_jvmMaximumMemory = nullptr;
}
{
// JRE System Library
const QString title = "JRE System Library";
@@ -466,11 +448,6 @@ void QtProjectWizardContentPreferences::load()
m_javaPath->setText(QString::fromStdWString(appSettings->getJavaPath().wstr()));
}
if (m_jvmMaximumMemory)
{
m_jvmMaximumMemory->setText(QString::number(appSettings->getJavaMaximumMemory()));
}
m_jreSystemLibraryPaths->setPaths(appSettings->getJreSystemLibraryPaths());
if (m_mavenPath)
@@ -535,15 +512,6 @@ void QtProjectWizardContentPreferences::save()
appSettings->setJreSystemLibraryPaths(m_jreSystemLibraryPaths->getPathsAsAbsolute());
if (m_jvmMaximumMemory)
{
const int jvmMaximumMemory = m_jvmMaximumMemory->text().toInt();
if (jvmMaximumMemory)
{
appSettings->setJavaMaximumMemory(jvmMaximumMemory);
}
}
if (m_mavenPath)
{
appSettings->setMavenPath(FilePath(m_mavenPath->getText().toStdWString()));
@@ -124,7 +124,6 @@ private:
QComboBox* m_mavenPathDetectorBox;
QtLocationPicker* m_javaPath;
QtPathListBox* m_jreSystemLibraryPaths;
QLineEdit* m_jvmMaximumMemory;
QtLocationPicker* m_mavenPath;
QCheckBox* m_pythonPostProcessing;
@@ -49,24 +49,7 @@ void JavaEnvironmentFactory::createInstance(std::string classPath, std::string&
s_classPath = classPath;
int jvmMaximumMemory = ApplicationSettings::getInstance()->getJavaMaximumMemory();
#ifdef WIN32
if (jvmMaximumMemory > 0)
{
const float underestimationFactor = 0.8f;
const int maximumMB = utility::getLargestByteSizeOfAllocatableMemory() / 1024 / 1024 * underestimationFactor;
if (jvmMaximumMemory > maximumMB)
{
LOG_WARNING("Selected amount of maximum JVM memory of " + std::to_string(jvmMaximumMemory) + " MB exceeds maximum allocatable "
"memory on system. Correcting selected value to " + std::to_string(maximumMB) + " MB.");
jvmMaximumMemory = maximumMB;
}
}
#endif // WIN32
const int optionCount = (jvmMaximumMemory < 0 ? 2 : 3);
const std::string maximumMemoryOprionString = "-Xmx" + std::to_string(jvmMaximumMemory) + "m";
const int optionCount = 2;
JavaVM* jvm = nullptr; // Pointer to the JVM (Java Virtual Machine)
JNIEnv* env = nullptr; // Pointer to native interface
@@ -84,10 +67,6 @@ void JavaEnvironmentFactory::createInstance(std::string classPath, std::string&
//options[5].optionString = const_cast<char*>("-Dcom.sun.management.jmxremote.authenticate=false");
//options[6].optionString = const_cast<char*>("-Dcom.sun.management.jmxremote.ssl=false");
if (optionCount == 3)
{
options[2].optionString = const_cast<char*>(maximumMemoryOprionString.c_str());
}
vm_args.version = JNI_VERSION_1_8;
vm_args.nOptions = optionCount;
vm_args.options = options;