diff options
author | Marcus Tillmanns <marcus.tillmanns@qt.io> | 2022-09-27 09:28:34 +0200 |
---|---|---|
committer | Marcus Tillmanns <marcus.tillmanns@qt.io> | 2022-09-27 08:24:43 +0000 |
commit | 5d4bbd38d485b2aa36e209ba6929b2456b828ac4 (patch) | |
tree | 3862a11304956266c1b6fcaaa590f4e14672655b /src/plugins/coreplugin/mainwindow.cpp | |
parent | 6465415bf5e6abc5245ae5d6c8373c8dad6cba87 (diff) |
MainWindow: Disable TrimTimer on non Linux Host
Timers showed up a lot during cpu profiling on macOS.
This is one of them. Since its only used on Linux,
this patch makes sure that its only started there as well.
Change-Id: I0da35473b622c92e39a7e45677441f1cd8aa3344
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/mainwindow.cpp')
-rw-r--r-- | src/plugins/coreplugin/mainwindow.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 0b6354aff4..7a9991eb6e 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -211,12 +211,14 @@ MainWindow::MainWindow() connect(dropSupport, &DropSupport::filesDropped, this, &MainWindow::openDroppedFiles); + if (HostOsInfo::isLinuxHost()) { + m_trimTimer.setSingleShot(true); + m_trimTimer.setInterval(60000); + // glibc may not actually free memory in free(). #ifdef Q_OS_LINUX - m_trimTimer.setSingleShot(true); - m_trimTimer.setInterval(60000); - // glibc may not actually free memory in free(). - connect(&m_trimTimer, &QTimer::timeout, this, [] { malloc_trim(0); }); + connect(&m_trimTimer, &QTimer::timeout, this, [] { malloc_trim(0); }); #endif + } } NavigationWidget *MainWindow::navigationWidget(Side side) const @@ -358,7 +360,7 @@ void MainWindow::restart() void MainWindow::restartTrimmer() { - if (!m_trimTimer.isActive()) + if (HostOsInfo::isLinuxHost() && !m_trimTimer.isActive()) m_trimTimer.start(); } |