summaryrefslogtreecommitdiff
path: root/src/progs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-06-10 03:31:18 +0300
committerAndrei Karas <akaras@inbox.ru>2019-06-10 03:31:18 +0300
commitbdc467e9f8d7c72d912eb7fdc434b3a14b52d901 (patch)
tree0b8a6f6a945314c05f66957ac2a6dc2c9b6b2664 /src/progs
parent96b6acb72bab198d278919daa11390c573341647 (diff)
downloadmv-bdc467e9f8d7c72d912eb7fdc434b3a14b52d901.tar.gz
mv-bdc467e9f8d7c72d912eb7fdc434b3a14b52d901.tar.bz2
mv-bdc467e9f8d7c72d912eb7fdc434b3a14b52d901.tar.xz
mv-bdc467e9f8d7c72d912eb7fdc434b3a14b52d901.zip
Add chat command /trimmemory for force trim freed memory
Diffstat (limited to 'src/progs')
-rw-r--r--src/progs/dyecmd/actions/commands.cpp1
-rw-r--r--src/progs/manaplus/actions/commands.cpp15
2 files changed, 16 insertions, 0 deletions
diff --git a/src/progs/dyecmd/actions/commands.cpp b/src/progs/dyecmd/actions/commands.cpp
index 217aa5b53..5ee4d3089 100644
--- a/src/progs/dyecmd/actions/commands.cpp
+++ b/src/progs/dyecmd/actions/commands.cpp
@@ -163,5 +163,6 @@ impHandlerVoid(moveAttackDown)
impHandlerVoid(movePriorityAttackUp)
impHandlerVoid(movePriorityAttackDown)
impHandlerVoid(addSkillShortcut)
+impHandlerVoid(trimMemory)
} // namespace Actions
diff --git a/src/progs/manaplus/actions/commands.cpp b/src/progs/manaplus/actions/commands.cpp
index ff24d6bc3..57f5125b2 100644
--- a/src/progs/manaplus/actions/commands.cpp
+++ b/src/progs/manaplus/actions/commands.cpp
@@ -85,6 +85,8 @@
#include "utils/parameters.h"
#include "utils/process.h"
+#include <malloc.h>
+
#include "debug.h"
namespace Actions
@@ -2200,4 +2202,17 @@ impHandler(addSkillShortcut)
return true;
}
+impHandler0(trimMemory)
+{
+#ifdef HAVE_MALLOC_TRIM
+ malloc_trim(0);
+#else
+ localChatTab->chatLog(_("Trim memory not supported"),
+ ChatMsgType::BY_SERVER,
+ IgnoreRecord_false,
+ TryRemoveColors_true);
+#endif
+ return true;
+}
+
} // namespace Actions