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
master
Philipp Knechtges 14 years ago
parent 135d835dd5
commit 6ad6c7da8b

@ -51,6 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QLabel> #include <QLabel>
#include <KComboBox> #include <KComboBox>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <kworkspace.h>
#include <ksmserver_interface.h> #include <ksmserver_interface.h>
@ -404,6 +405,8 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
} }
} }
KWorkSpace::trimMalloc();
Display* dpy = XOpenDisplay(NULL); Display* dpy = XOpenDisplay(NULL);
if (!dpy) { if (!dpy) {
fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n", fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n",

Loading…
Cancel
Save