summaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2019-04-15 19:49:30 +0200
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-05-11 15:34:33 +0200
commit140a96b3a0fa652b66c701ac941cebc17ff24622 (patch)
treeec64deb3e7ef5032dc18991cf5bb0d4eede52fb5 /src/table
parentc9fe6e7b8fde3a23f6aab3b55fd8cca639d49696 (diff)
downloadopenttd-140a96b3a0fa652b66c701ac941cebc17ff24622.tar.xz
Change: Limit memory allocations for each Squirrel instance
This can avoid out-of-memory situations due to single scripts using up the entire address space. Instead, scripts that go above the maximum are killed. The maximum is default 1 GB per script, but can be configured by a setting.
Diffstat (limited to 'src/table')
-rw-r--r--src/table/settings.ini15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/table/settings.ini b/src/table/settings.ini
index 9e3fa0054..800d6f79c 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -1555,6 +1555,21 @@ strhelp = STR_CONFIG_SETTING_SCRIPT_MAX_OPCODES_HELPTEXT
strval = STR_JUST_COMMA
cat = SC_EXPERT
+[SDT_VAR]
+base = GameSettings
+var = script.script_max_memory_megabytes
+type = SLE_UINT32
+from = SLV_SCRIPT_MEMLIMIT
+guiflags = SGF_NEWGAME_ONLY
+def = 1024
+min = 8
+max = 8192
+interval = 8
+str = STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY
+strhelp = STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT
+strval = STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE
+cat = SC_EXPERT
+
##
[SDT_VAR]
base = GameSettings