diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt index 75773a4..25d3016 100644 --- a/frontend/CMakeLists.txt +++ b/frontend/CMakeLists.txt @@ -91,6 +91,7 @@ target_link_libraries(ukui-search PRIVATE chinese-segmentation kysdk-waylandhelper qtsingleapplication + tcmalloc_minimal ) target_include_directories(ukui-search PRIVATE diff --git a/frontend/mainwindow.cpp b/frontend/mainwindow.cpp index 83e2826..c9c847e 100644 --- a/frontend/mainwindow.cpp +++ b/frontend/mainwindow.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "ukuistylehelper/ukuistylehelper.h" #include "windowmanager/windowmanager.h" #include "global-settings.h" @@ -374,6 +375,15 @@ bool MainWindow::tryHideMainwindow() Q_EMIT m_searchResultPage->stopSearch(); this->clearSearchResult(); this->hide(); + if(!m_releaseFreeMemoryTimerWorking) { + m_releaseFreeMemoryTimerWorking = true; + QTimer::singleShot(2000, this, [&](){ + if(!this->isVisible()) { + MallocExtension::instance()->ReleaseFreeMemory(); + } + m_releaseFreeMemoryTimerWorking = false; + }); + } return true; } else { //有上层弹窗未关闭,不允许隐藏主界面 diff --git a/frontend/mainwindow.h b/frontend/mainwindow.h index 01189e6..7ced129 100644 --- a/frontend/mainwindow.h +++ b/frontend/mainwindow.h @@ -115,6 +115,7 @@ private: QSettings *m_settings = nullptr; AppWidgetPlugin *m_appWidgetPlugin = nullptr; bool m_isIndexSearch = false; + bool m_releaseFreeMemoryTimerWorking = false; }; } diff --git a/frontend/ukui-search-gui.cpp b/frontend/ukui-search-gui.cpp index 9cd0da3..ecaa4ae 100644 --- a/frontend/ukui-search-gui.cpp +++ b/frontend/ukui-search-gui.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "plugin-manager.h" #include "icon-loader.h" @@ -71,6 +72,7 @@ UkuiSearchGui::UkuiSearchGui(int &argc, } qDebug() << "Loading plugins and resources..."; + MallocExtension::Initialize(); SearchPluginManager::getInstance(); PluginManager::getInstance(); diff --git a/translations/ukui-search/appwidget/search_bo_CN.ts b/translations/ukui-search/appwidget/search_bo_CN.ts index b0ba42a..5e474d2 100644 --- a/translations/ukui-search/appwidget/search_bo_CN.ts +++ b/translations/ukui-search/appwidget/search_bo_CN.ts @@ -50,12 +50,12 @@ UkuiSearch::MainWindow - + ukui-search - + Global Search @@ -71,32 +71,32 @@ UkuiSearch::UkuiSearchGui - + Quit ukui-search application - + Show main window - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/appwidget/search_mn.ts b/translations/ukui-search/appwidget/search_mn.ts index 63cabce..c1619e0 100644 --- a/translations/ukui-search/appwidget/search_mn.ts +++ b/translations/ukui-search/appwidget/search_mn.ts @@ -50,12 +50,12 @@ UkuiSearch::MainWindow - + ukui-search - + Global Search @@ -71,32 +71,32 @@ UkuiSearch::UkuiSearchGui - + Quit ukui-search application - + Show main window - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/bo_CN.ts b/translations/ukui-search/bo_CN.ts index 9bcea0a..00ece4f 100644 --- a/translations/ukui-search/bo_CN.ts +++ b/translations/ukui-search/bo_CN.ts @@ -57,12 +57,12 @@ UkuiSearch::MainWindow - + ukui-search འཚོལ་བཤེར། - + Global Search འཚོལ་བཤེར། @@ -205,32 +205,32 @@ UkuiSearch::UkuiSearchGui - + Quit ukui-search application ཉེར་སྤྱོད་གོ་རིམ་ལས་ཕྱིར་འཐེན་བྱ། - + Show main window སྒེའུ་ཁུང་གཙོ་བོ་མངོན་པ། - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/mn.ts b/translations/ukui-search/mn.ts index 82e2288..abaae59 100644 --- a/translations/ukui-search/mn.ts +++ b/translations/ukui-search/mn.ts @@ -57,12 +57,12 @@ UkuiSearch::MainWindow - + ukui-search ᠬᠠᠢᠯᠲᠠ - + Global Search ᠬᠠᠢᠯᠲᠠ @@ -205,32 +205,32 @@ UkuiSearch::UkuiSearchGui - + Quit ukui-search application ᠬᠠᠢᠯᠲᠠ᠎ᠶᠢᠨ ᠬᠡᠷᠡᠭᠯᠡᠯᠳᠡ᠎ᠡᠴᠡ ᠪᠤᠴᠠᠵᠤ ᠭᠠᠷᠬᠤ - + Show main window ᠭᠤᠤᠯ ᠨᠢᠭᠤᠷ ᠬᠠᠭᠤᠳᠠᠰᠤ᠎ᠶᠢ ᠢᠯᠡᠷᠡᠬᠦᠯᠬᠦ᠌ - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 2602e94..af30fcf 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -357,12 +357,12 @@ UkuiSearch::MainWindow - + ukui-search - + Global Search Genel Arama @@ -541,32 +541,32 @@ UkuiSearch::UkuiSearchGui - + Quit ukui-search application - + Show main window - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index 56d4c51..4264438 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -119,12 +119,12 @@ UkuiSearch::MainWindow - + ukui-search 搜索 - + Global Search 搜索 @@ -351,32 +351,32 @@ UkuiSearch::UkuiSearchGui - + Quit ukui-search application 退出搜索应用 - + Show main window 显示主页面 - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index>