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