NOISSUE set max of java heap spinboxes to detected physical memory

This commit is contained in:
Petr Mrázek 2017-07-11 22:43:35 +02:00
parent 5ea170db78
commit afb0db24a8
4 changed files with 8 additions and 1 deletions

View File

@ -11,12 +11,15 @@
#include <java/JavaInstallList.h> #include <java/JavaInstallList.h>
#include <FileSystem.h> #include <FileSystem.h>
#include <sys.h>
InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent) InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
: QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst) : QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst)
{ {
m_settings = inst->settings(); m_settings = inst->settings();
ui->setupUi(this); ui->setupUi(this);
auto sysMB = Sys::getSystemRam() / Sys::megabyte;
ui->maxMemSpinBox->setMaximum(sysMB);
loadSettings(); loadSettings();
} }

View File

@ -30,6 +30,7 @@
#include "settings/SettingsObject.h" #include "settings/SettingsObject.h"
#include <FileSystem.h> #include <FileSystem.h>
#include "MultiMC.h" #include "MultiMC.h"
#include <sys.h>
JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage) JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage)
{ {
@ -40,6 +41,8 @@ JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage)
resizer->addWidgetsFromLayout(ui->javaSettingsGroupBox->layout(), 0); resizer->addWidgetsFromLayout(ui->javaSettingsGroupBox->layout(), 0);
resizer->addWidgetsFromLayout(ui->customCommandsGroupBox->layout(), 0); resizer->addWidgetsFromLayout(ui->customCommandsGroupBox->layout(), 0);
auto sysMB = Sys::getSystemRam() / Sys::megabyte;
ui->maxMemSpinBox->setMaximum(sysMB);
loadSettings(); loadSettings();
} }

View File

@ -22,7 +22,7 @@
JavaWizardPage::JavaWizardPage(QWidget *parent) JavaWizardPage::JavaWizardPage(QWidget *parent)
:BaseWizardPage(parent) :BaseWizardPage(parent)
{ {
m_availableMemory = Sys::getSystemRam() / (1024ull * 1024ull); m_availableMemory = Sys::getSystemRam() / Sys::megabyte;
goodIcon = MMC->getThemedIcon("status-good"); goodIcon = MMC->getThemedIcon("status-good");
yellowIcon = MMC->getThemedIcon("status-yellow"); yellowIcon = MMC->getThemedIcon("status-yellow");

View File

@ -3,6 +3,7 @@
namespace Sys namespace Sys
{ {
const uint64_t megabyte = 1024ull * 1024ull;
struct KernelInfo struct KernelInfo
{ {
QString kernelName; QString kernelName;