From bdc467e9f8d7c72d912eb7fdc434b3a14b52d901 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 10 Jun 2019 03:31:18 +0300 Subject: Add chat command /trimmemory for force trim freed memory --- src/progs/manaplus/actions/commands.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/progs/manaplus/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 + #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 -- cgit v1.2.3-70-g09d2