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
This commit is contained in:
Philipp Knechtges 2011-05-21 14:32:30 +02:00
parent 135d835dd5
commit 6ad6c7da8b

View file

@ -51,6 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QLabel>
#include <KComboBox>
#include <QVBoxLayout>
#include <kworkspace.h>
#include <ksmserver_interface.h>
@ -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",