new/yocto/meta-qt5/recipes-qt/qt5/qt5-creator/0001-app-Use-malloc_trim-only-on-glibc.patch
2025-05-10 21:58:58 +08:00

33 lines
965 B
Diff

From 46ec546fdc4427019184f84f24efe3e145b7e40f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 11 Aug 2020 21:19:22 -0700
Subject: [PATCH] app: Use malloc_trim only on glibc
musl does not implement it
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/app/main.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 419b9b362a..9e150e7613 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -719,7 +719,11 @@ int main(int argc, char **argv)
m_trimTimer.setSingleShot(true);
m_trimTimer.setInterval(60000);
// glibc may not actually free memory in free().
+#ifdef __GLIBC__
connect(&m_trimTimer, &QTimer::timeout, this, [] { malloc_trim(0); });
+#else
+ connect(&m_trimTimer, &QTimer::timeout, this, [] { });
+#endif
}
bool eventFilter(QObject *, QEvent *e) override
--
2.28.0