perf(frontend):使用tcmalloc优化内存占用与内存与内存碎片问题
This commit is contained in:
parent
edd051de40
commit
b70562c76c
|
@ -91,6 +91,7 @@ target_link_libraries(ukui-search PRIVATE
|
|||
chinese-segmentation
|
||||
kysdk-waylandhelper
|
||||
qtsingleapplication
|
||||
tcmalloc_minimal
|
||||
)
|
||||
|
||||
target_include_directories(ukui-search PRIVATE
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <KWindowEffects>
|
||||
#include <KWindowSystem>
|
||||
#include <QtX11Extras/QX11Info>
|
||||
#include <gperftools/malloc_extension.h>
|
||||
#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 {
|
||||
//有上层弹窗未关闭,不允许隐藏主界面
|
||||
|
|
|
@ -115,6 +115,7 @@ private:
|
|||
QSettings *m_settings = nullptr;
|
||||
AppWidgetPlugin *m_appWidgetPlugin = nullptr;
|
||||
bool m_isIndexSearch = false;
|
||||
bool m_releaseFreeMemoryTimerWorking = false;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QTranslator>
|
||||
#include <QLocale>
|
||||
#include <QApplication>
|
||||
#include <gperftools/malloc_extension.h>
|
||||
#include <QCommandLineParser>
|
||||
#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();
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@
|
|||
<context>
|
||||
<name>UkuiSearch::MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="72"/>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="73"/>
|
||||
<source>ukui-search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="80"/>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -71,32 +71,32 @@
|
|||
<context>
|
||||
<name>UkuiSearch::UkuiSearchGui</name>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="109"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="111"/>
|
||||
<source>Quit ukui-search application</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="112"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="114"/>
|
||||
<source>Show main window</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="115"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="117"/>
|
||||
<source>unregister a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="118"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="120"/>
|
||||
<source>register a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="121"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="123"/>
|
||||
<source>move <pluginName> to the target pos</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="124"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="126"/>
|
||||
<source>move plugin to <index></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -50,12 +50,12 @@
|
|||
<context>
|
||||
<name>UkuiSearch::MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="72"/>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="73"/>
|
||||
<source>ukui-search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="80"/>
|
||||
<location filename="../../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -71,32 +71,32 @@
|
|||
<context>
|
||||
<name>UkuiSearch::UkuiSearchGui</name>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="109"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="111"/>
|
||||
<source>Quit ukui-search application</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="112"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="114"/>
|
||||
<source>Show main window</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="115"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="117"/>
|
||||
<source>unregister a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="118"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="120"/>
|
||||
<source>register a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="121"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="123"/>
|
||||
<source>move <pluginName> to the target pos</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="124"/>
|
||||
<location filename="../../../frontend/ukui-search-gui.cpp" line="126"/>
|
||||
<source>move plugin to <index></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -57,12 +57,12 @@
|
|||
<context>
|
||||
<name>UkuiSearch::MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="72"/>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="73"/>
|
||||
<source>ukui-search</source>
|
||||
<translation>འཚོལ་བཤེར།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="80"/>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Global Search</source>
|
||||
<translation>འཚོལ་བཤེར།</translation>
|
||||
</message>
|
||||
|
@ -205,32 +205,32 @@
|
|||
<context>
|
||||
<name>UkuiSearch::UkuiSearchGui</name>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="109"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="111"/>
|
||||
<source>Quit ukui-search application</source>
|
||||
<translation>ཉེར་སྤྱོད་གོ་རིམ་ལས་ཕྱིར་འཐེན་བྱ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="112"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="114"/>
|
||||
<source>Show main window</source>
|
||||
<translation>སྒེའུ་ཁུང་གཙོ་བོ་མངོན་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="115"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="117"/>
|
||||
<source>unregister a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="118"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="120"/>
|
||||
<source>register a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="121"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="123"/>
|
||||
<source>move <pluginName> to the target pos</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="124"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="126"/>
|
||||
<source>move plugin to <index></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -57,12 +57,12 @@
|
|||
<context>
|
||||
<name>UkuiSearch::MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="72"/>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="73"/>
|
||||
<source>ukui-search</source>
|
||||
<translation>ᠬᠠᠢᠯᠲᠠ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="80"/>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Global Search</source>
|
||||
<translation>ᠬᠠᠢᠯᠲᠠ</translation>
|
||||
</message>
|
||||
|
@ -205,32 +205,32 @@
|
|||
<context>
|
||||
<name>UkuiSearch::UkuiSearchGui</name>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="109"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="111"/>
|
||||
<source>Quit ukui-search application</source>
|
||||
<translation>ᠬᠠᠢᠯᠲᠠᠶᠢᠨ ᠬᠡᠷᠡᠭᠯᠡᠯᠳᠡᠡᠴᠡ ᠪᠤᠴᠠᠵᠤ ᠭᠠᠷᠬᠤ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="112"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="114"/>
|
||||
<source>Show main window</source>
|
||||
<translation>ᠭᠤᠤᠯ ᠨᠢᠭᠤᠷ ᠬᠠᠭᠤᠳᠠᠰᠤᠶᠢ ᠢᠯᠡᠷᠡᠬᠦᠯᠬᠦ᠌</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="115"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="117"/>
|
||||
<source>unregister a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="118"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="120"/>
|
||||
<source>register a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="121"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="123"/>
|
||||
<source>move <pluginName> to the target pos</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="124"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="126"/>
|
||||
<source>move plugin to <index></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -357,12 +357,12 @@
|
|||
<context>
|
||||
<name>UkuiSearch::MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="72"/>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="73"/>
|
||||
<source>ukui-search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="80"/>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished">Genel Arama</translation>
|
||||
</message>
|
||||
|
@ -541,32 +541,32 @@
|
|||
<context>
|
||||
<name>UkuiSearch::UkuiSearchGui</name>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="109"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="111"/>
|
||||
<source>Quit ukui-search application</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="112"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="114"/>
|
||||
<source>Show main window</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="115"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="117"/>
|
||||
<source>unregister a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="118"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="120"/>
|
||||
<source>register a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="121"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="123"/>
|
||||
<source>move <pluginName> to the target pos</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="124"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="126"/>
|
||||
<source>move plugin to <index></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -119,12 +119,12 @@
|
|||
<context>
|
||||
<name>UkuiSearch::MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="72"/>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="73"/>
|
||||
<source>ukui-search</source>
|
||||
<translation>搜索</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="80"/>
|
||||
<location filename="../../frontend/mainwindow.cpp" line="81"/>
|
||||
<source>Global Search</source>
|
||||
<translation>搜索</translation>
|
||||
</message>
|
||||
|
@ -351,32 +351,32 @@
|
|||
<context>
|
||||
<name>UkuiSearch::UkuiSearchGui</name>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="109"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="111"/>
|
||||
<source>Quit ukui-search application</source>
|
||||
<translation>退出搜索应用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="112"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="114"/>
|
||||
<source>Show main window</source>
|
||||
<translation>显示主页面</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="115"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="117"/>
|
||||
<source>unregister a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="118"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="120"/>
|
||||
<source>register a plugin with <pluginName></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="121"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="123"/>
|
||||
<source>move <pluginName> to the target pos</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="124"/>
|
||||
<location filename="../../frontend/ukui-search-gui.cpp" line="126"/>
|
||||
<source>move plugin to <index></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in New Issue