From 6ad6c7da8b0a0a4cf338ebbb1943c5ddab9b0476 Mon Sep 17 00:00:00 2001 From: Philipp Knechtges Date: Sat, 21 May 2011 14:32:30 +0200 Subject: [PATCH] libkworkspace: tuning glibc allocator Some applications like kwin suffer from heap fragmentation when using the raster graphicssystem. This patch provides a function that forces glibc to shrink the heap more often. Now 5*pagesize(=20kB on a typical x86 system) of unused space at the end of the heap are enough to force free() to release this space. The default threshold is 128kB which is too much for an average kworkspace application. REVIEW: 101385 --- main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.cpp b/main.cpp index f767f54adb..b92bee6f51 100644 --- a/main.cpp +++ b/main.cpp @@ -51,6 +51,7 @@ along with this program. If not, see . #include #include #include +#include #include @@ -404,6 +405,8 @@ KDE_EXPORT int kdemain(int argc, char * argv[]) } } + KWorkSpace::trimMalloc(); + Display* dpy = XOpenDisplay(NULL); if (!dpy) { fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n",