Skip to content

Custom dynamic memory limit #2008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ void Configuration::ReadConfig() {
config->Read("greekSidebar_Show_mu", &m_greekSidebar_Show_mu);
config->Read("symbolPaneAdditionalChars", &m_symbolPaneAdditionalChars);
config->Read("parameters", &m_maximaParameters);
config->Read("enableCustomDynamicMemory", &m_maximaEnableCustomDynamicMemory);
config->Read("customDynamicMemory", &m_maximaCustomDynamicMemory);
config->Read("autodetectHelpBrowser", &m_autodetectHelpBrowser);
config->Read(wxS("useInternalHelpBrowser"), &m_useInternalHelpBrowser);
config->Read(wxS("singlePageManual"), &m_singlePageManual);
Expand Down Expand Up @@ -1617,6 +1619,8 @@ void Configuration::WriteStyles(wxConfigBase *config) {
config->Write(wxS("printBrackets"), m_printBrackets);
config->Write(wxS("autodetectMaxima"), m_autodetectMaxima);
config->Write(wxS("parameters"), m_maximaParameters);
config->Write(wxS("enableCustomDynamicMemory"), m_maximaEnableCustomDynamicMemory);
config->Write(wxS("customDynamicMemory"), m_maximaCustomDynamicMemory);
config->Write(wxS("maxima"), m_maximaUserLocation);
config->Write(wxS("autodetectHelpBrowser"), m_autodetectHelpBrowser);
if (OfferInternalHelpBrowser())
Expand Down
11 changes: 11 additions & 0 deletions src/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,15 @@ class Configuration
//! The parameters we pass to the maxima binary
void MaximaParameters(wxString parameters){m_maximaParameters = std::move(parameters);}

//! Dynamic memory parameter to maxima binary
bool MaximaEnableCustomDynamicMemory() const {return m_maximaEnableCustomDynamicMemory;}
//! The dynamic memory parameter for the maxima binary
void MaximaEnableCustomDynamicMemory(bool enable) {m_maximaEnableCustomDynamicMemory = enable;}
//! Dynamic memory parameter to maxima binary if MaximaEnableCustomDynamicMemory() is true. Otherwise this parameter is ignored
int MaximaCustomDynamicMemory() const {return m_maximaCustomDynamicMemory;}
//! The dynamic memory parameter for the maxima binary if MaximaEnableCustomDynamicMemory() is true. Otherwise this parameter is ignored
void MaximaCustomDynamicMemory(int memory) {m_maximaCustomDynamicMemory = memory;}

//! The auto-detected maxima location
static wxString MaximaDefaultLocation();

Expand Down Expand Up @@ -1200,6 +1209,8 @@ class Configuration
bool m_clipToDrawRegion = true;
bool m_outdated;
wxString m_maximaParameters;
bool m_maximaEnableCustomDynamicMemory{false};
int m_maximaCustomDynamicMemory{1000};
bool m_keepPercent;
bool m_restartOnReEvaluation;
wxString m_fontCMRI, m_fontCMSY, m_fontCMEX, m_fontCMMI, m_fontCMTI;
Expand Down
32 changes: 32 additions & 0 deletions src/dialogs/ConfigDialogue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ void ConfigDialogue::SetCheckboxValues() {
_("Enter the path to the Maxima executable."));
m_additionalParameters->SetToolTip(_("Additional parameters for Maxima"
" (e.g. -l clisp)."));

m_enableDynamicMemorySpace->SetToolTip(_("If enabled the value in the spinbox is used new memory limit for maxima "
"equal to: -X \"--dynamic-space-size <value>\""));
m_dynamicMemorySpace->SetToolTip(_("The new memory limit for maxima in MB"));

m_mathJaxURL->SetToolTip(
_("The URL MathJaX.js should be downloaded from by our HTML export."));
m_texPreamble->SetToolTip(_("Additional commands to be added to the preamble "
Expand Down Expand Up @@ -484,6 +489,9 @@ void ConfigDialogue::SetCheckboxValues() {
m_maximaUserLocation->SetValue(configuration->MaximaUserLocation());

m_additionalParameters->SetValue(configuration->MaximaParameters());
m_enableDynamicMemorySpace->SetValue(configuration->MaximaEnableCustomDynamicMemory());
m_dynamicMemorySpace->SetValue(configuration->MaximaCustomDynamicMemory());

m_usesvg->SetValue(configuration->UseSVG());

m_TeXExponentsAfterSubscript->SetValue(
Expand Down Expand Up @@ -1333,6 +1341,7 @@ wxWindow *ConfigDialogue::CreateMaximaPanel() {

wxFlexGridSizer *sizer = new wxFlexGridSizer(5, 2, 0, 0);
wxFlexGridSizer *sizer2 = new wxFlexGridSizer(6, 2, 0, 0);
wxFlexGridSizer *dynamicMemory = new wxFlexGridSizer(1, 3, 0, 0);
wxBoxSizer *vsizer = new wxBoxSizer(wxVERTICAL);
panel->SetSizer(vsizer);
wxStaticBoxSizer *invocationSizer =
Expand Down Expand Up @@ -1497,6 +1506,27 @@ wxWindow *ConfigDialogue::CreateMaximaPanel() {
m_additionalParameters,
wxSizerFlags().Border(wxRIGHT, 10 * GetContentScaleFactor()).Expand());

configSizer->Add(10 * GetContentScaleFactor(), 10 * GetContentScaleFactor());

dynamicMemory->Add(new wxStaticText(
configSizer->GetStaticBox(), wxID_ANY,
_("Overwrite Maxima Default Memory Limit [MB]: ")), wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 20);

m_enableDynamicMemorySpace = new wxCheckBox(
configSizer->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition);
dynamicMemory->Add(
m_enableDynamicMemorySpace,
wxSizerFlags().Border(wxRIGHT, 10 * GetContentScaleFactor()).Expand());

m_dynamicMemorySpace = new wxSpinCtrl(configSizer->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition);
m_dynamicMemorySpace->SetRange(1000, std::numeric_limits<int>::max());
m_dynamicMemorySpace->SetValue(1000);
dynamicMemory->Add(
m_dynamicMemorySpace,
wxSizerFlags().Border(wxRIGHT, 10 * GetContentScaleFactor()).Expand());

configSizer->Add(dynamicMemory);

configSizer->Add(10 * GetContentScaleFactor(), 10 * GetContentScaleFactor());
m_maximaEnvVariables = new wxGrid(configSizer->GetStaticBox(), wxID_ANY);
m_maximaEnvVariables->CreateGrid(0, 2);
Expand Down Expand Up @@ -2129,6 +2159,8 @@ void ConfigDialogue::WriteSettings() {
configuration->AutodetectHelpBrowser(m_autodetectHelpBrowser->GetValue());
}
configuration->MaximaParameters(m_additionalParameters->GetValue());
configuration->MaximaEnableCustomDynamicMemory(m_enableDynamicMemorySpace->GetValue());
configuration->MaximaCustomDynamicMemory(m_dynamicMemorySpace->GetValue());
configuration->SetMatchParens(m_matchParens->GetValue());
configuration->ShowMatchingParens(m_showMatchingParens->GetValue());
configuration->ShowLength(m_showLength->GetSelection());
Expand Down
2 changes: 2 additions & 0 deletions src/dialogs/ConfigDialogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ class ConfigDialogue : public wxPropertySheetDialog
wxCheckBox *m_autoSave;
wxButton *m_wxMathMLBrowse;
wxTextCtrl *m_additionalParameters;
wxCheckBox *m_enableDynamicMemorySpace;
wxSpinCtrl *m_dynamicMemorySpace;
wxTextCtrl *m_mathJaxURL;
wxChoice *m_language;
wxTextCtrl *m_symbolPaneAdditionalChars;
Expand Down
3 changes: 3 additions & 0 deletions src/wxMaxima.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4850,6 +4850,9 @@ wxString wxMaxima::GetCommand(bool params) {
} else {
command = wxS("\"") + command + wxS("\"");
}
if (m_configuration.MaximaEnableCustomDynamicMemory()) {
command = command + wxS(" -X \"--dynamic-space-size ") + wxString::Format(wxT("%i"), m_configuration.MaximaCustomDynamicMemory()) + wxS("\"");
}
wxString extraMaximaArgs = ExtraMaximaArgs();
if (!extraMaximaArgs.IsEmpty())
{
Expand Down
Loading