Move trim malloc from KWorkspace to KWin
It is only used by KWin and KWin does not use anything else from KWorkspace. REVIEW: 104446
This commit is contained in:
parent
7c00ab45f7
commit
561199762f
2 changed files with 25 additions and 4 deletions
|
@ -54,7 +54,6 @@ include_directories(BEFORE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libkdecorations
|
${CMAKE_CURRENT_SOURCE_DIR}/libkdecorations
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/effects
|
${CMAKE_CURRENT_SOURCE_DIR}/effects
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tabbox
|
${CMAKE_CURRENT_SOURCE_DIR}/tabbox
|
||||||
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kworkspace
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory( libkdecorations )
|
add_subdirectory( libkdecorations )
|
||||||
|
@ -173,7 +172,7 @@ qt4_add_dbus_interface( kwin_KDEINIT_SRCS
|
||||||
|
|
||||||
qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc )
|
qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc )
|
||||||
|
|
||||||
set(kwinLibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} kdeclarative kworkspace kdecorations kwineffects ${X11_LIBRARIES} ${X11_Xrandr_LIB} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB} ${X11_Xrender_LIB} ${X11_Xfixes_LIB})
|
set(kwinLibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} kdeclarative kdecorations kwineffects ${X11_LIBRARIES} ${X11_Xrandr_LIB} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB} ${X11_Xrender_LIB} ${X11_Xfixes_LIB})
|
||||||
|
|
||||||
find_library(XF86VM_LIBRARY Xxf86vm)
|
find_library(XF86VM_LIBRARY Xxf86vm)
|
||||||
if (XF86VM_LIBRARY)
|
if (XF86VM_LIBRARY)
|
||||||
|
|
26
main.cpp
26
main.cpp
|
@ -53,7 +53,16 @@ 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/kworkspace.h>
|
|
||||||
|
#include "config-workspace.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif // HAVE_UNISTD_H
|
||||||
|
|
||||||
|
#ifdef HAVE_MALLOC_H
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif // HAVE_MALLOC_H
|
||||||
|
|
||||||
#include <ksmserver_interface.h>
|
#include <ksmserver_interface.h>
|
||||||
|
|
||||||
|
@ -407,7 +416,20 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KWorkSpace::trimMalloc();
|
#ifdef M_TRIM_THRESHOLD
|
||||||
|
// Prevent fragmentation of the heap by malloc (glibc).
|
||||||
|
//
|
||||||
|
// The default threshold is 128*1024, which can result in a large memory usage
|
||||||
|
// due to fragmentation especially if we use the raster graphicssystem. On the
|
||||||
|
// otherside if the threshold is too low, free() starts to permanently ask the kernel
|
||||||
|
// about shrinking the heap.
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
const int pagesize = sysconf(_SC_PAGESIZE);
|
||||||
|
#else
|
||||||
|
const int pagesize = 4*1024;
|
||||||
|
#endif // HAVE_UNISTD_H
|
||||||
|
mallopt(M_TRIM_THRESHOLD, 5*pagesize);
|
||||||
|
#endif // M_TRIM_THRESHOLD
|
||||||
|
|
||||||
// the raster graphicssystem has a quite terrible performance on the XRender backend or when not
|
// the raster graphicssystem has a quite terrible performance on the XRender backend or when not
|
||||||
// compositing at all while some to many decorations suffer from bad performance of the native
|
// compositing at all while some to many decorations suffer from bad performance of the native
|
||||||
|
|
Loading…
Reference in a new issue