diff options
author | Ryan Cao <70191398+ryanccn@users.noreply.github.com> | 2022-11-14 19:26:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 19:26:31 +0800 |
commit | 2c9452efaf33cb22dbc29a4c6117a646f0de943f (patch) | |
tree | c5394f5194066989504b572c5a4aeeeb74d954d9 /launcher/Application.cpp | |
parent | 97a7af855f8a96a0e73181c5e32a15bbd2cb67f2 (diff) | |
parent | 074b53eb6b71f948ff30aca601103672c5c4c812 (diff) | |
download | PrismLauncher-2c9452efaf33cb22dbc29a4c6117a646f0de943f.tar.gz PrismLauncher-2c9452efaf33cb22dbc29a4c6117a646f0de943f.tar.bz2 PrismLauncher-2c9452efaf33cb22dbc29a4c6117a646f0de943f.zip |
Merge branch 'develop' into macos-add-to-path
Diffstat (limited to 'launcher/Application.cpp')
-rw-r--r-- | launcher/Application.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 579942f4..45cd9422 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -563,7 +563,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) // Memory m_settings->registerSetting({"MinMemAlloc", "MinMemoryAlloc"}, 512); - m_settings->registerSetting({"MaxMemAlloc", "MaxMemoryAlloc"}, 4096); + m_settings->registerSetting({"MaxMemAlloc", "MaxMemoryAlloc"}, suitableMaxMem()); m_settings->registerSetting("PermGen", 128); // Java Settings @@ -611,6 +611,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) // The cat m_settings->registerSetting("TheCat", false); + m_settings->registerSetting("ToolbarsLocked", false); + m_settings->registerSetting("InstSortMode", "Name"); m_settings->registerSetting("SelectedInstance", QString()); @@ -1589,3 +1591,17 @@ QString Application::getUserAgentUncached() return BuildConfig.USER_AGENT_UNCACHED; } + +int Application::suitableMaxMem() +{ + float totalRAM = (float)Sys::getSystemRam() / (float)Sys::mebibyte; + int maxMemoryAlloc; + + // If totalRAM < 6GB, use (totalRAM / 1.5), else 4GB + if (totalRAM < (4096 * 1.5)) + maxMemoryAlloc = (int) (totalRAM / 1.5); + else + maxMemoryAlloc = 4096; + + return maxMemoryAlloc; +} |