kde, xfree & RAM

Lubos Lunak l.lunak at suse.cz
Fri Jun 11 15:40:45 CEST 2004


On Thursday 10 of June 2004 23:20, Waldo Bastian wrote:
> On Thu June 10 2004 16:15, M. Fioretti wrote:
> > It really looks like you are asking for this:
> >
> > http://www.rule-project.org/article.php3?id_article=59
> >
> > doesn't it? Or, at the very least, that every answer to the questions
> > below is relevant to that page, and we at RULE would really love to
> > help with this. If nothing else, by testing, and documenting
> > everything on this "make kde really light" issue.
> >
> > What do you think? And what can KDE developers suggest on this?
>
> Start with making some good tools to visualize which memory is used for
> what, e.g. how many code pages are in use by a certain library, how many
> data pages are in use by each process, how many pages are actually shared
> and by which processes, how much memory is the kernel using and for which
> tasks.
>
> It may also be interesting to relate memory usage in the X-server with the
> actual applications. I believe there are tools for that already.

 xrestop

>
> Once you are able to account somewhat accurately for all the memory in a
> system you will be able to identify problem spots and I'm sure that a lot
> of people will then be interested in solving such problem areas.

 Using kdesdk/kmtrace (from CVS HEAD) or memprof can help with allocations 
done by application.

 With memprof it's just 'memprof -- app args', and it has GUI, but I 
personally find kmtrace better, although slightly more difficult to use (and 
it has some features which are actually not documented :-/ , I wonder if 
there's a person who knows what all it can do ).

 For example the attached file is a tree of allocations after kwrite starts 
up. Done using LD_PRELOAD as the README says and used --tree --th with 
kmtrace. Although one can start and stop logging the allocations directly 
from the app if linked against libktrace, there's no simple way how to do the 
dump with LD_PRELOAD, so I had to attach gdb and do 'call kuntrace()'. Would 
be nice if there was some GUI for it.

 BTW, if you look at the tree (left number size allocated, right number number 
of allocations), pay special attention to Xft+fontconfig+freetype allocating 
more than 0.6 MiB and XIM about 0.35 MiB for something that's most probably 
the same data all the time. Do the maths yourself.

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/
-------------- next part --------------
+- 2886068/79407 libc.so.6(__libc_start_main+0xe0)[0x41539500]
\+- 2886068/79407 ??:0(main)[0x080486de]
 ++- 1605329/41372 libkdeinit_kwrite.so(kdemain+0xbce)[0x401d8cae]
 |++- 951797/22701 libkdeinit_kwrite.so(KWrite::KWrite(KTextEditor::Document*)+0x462)[0x401d7cb2]
 ||\+- 949693/22608 libktexteditor.so.0(KTextEditor::EditorChooser::createDocument(QObject*, char const*, QString const&, bool)+0x13f)[0x4021e81f]
 || \+- 903634/22213 libktexteditor.so.0(KTextEditor::createDocument(char const*, QObject*, char const*)+0xcb)[0x4021e62b]
 ||  \+- 903546/22208 libkparts.so.2(KParts::Factory::createPart(QWidget*, char const*, QObject*, char const*, char const*, QStringList const&)+0x4f)[0x4024ff7f]
 ||   ++- 601125/8806 libkatepart.so(KateFactoryPublic::createPartObject(QWidget*, char const*, QObject*, char const*, char const*, QStringList const&)+0x17)[0x41b7ced7]
 ||   |\+- 600905/8804 libkatepart.so(KateFactory::self()+0x4b)[0x41b16e7b]
 ||   | \+- 564084/7587 libkatepart.so(KateFactory::KateFactory()+0x789)[0x41b16d49]
 ||   |  \+- 471821/7440 libkatepart.so(KateRendererConfig::KateRendererConfig()+0x46)[0x41b19656]
 ||   |   \+- 471821/7440 libkatepart.so(FontStruct::FontStruct()+0xba)[0x41aebfea]
 ||   |    \+- 471821/7440 libkatepart.so(FontStruct::updateFontData()+0x28)[0x41aea708]
 ||   |     \+- 471821/7440 libqt-mt.so.3(QFontMetrics::ascent() const+0x43)[0x40ce2193]
 ||   |      \+- 470237/7438 libqt-mt.so.3(QFontPrivate::load(QFont::Script)+0x52a)[0x40c778fa]
 ||   |       +- 315583/7282 libqt-mt.so.3(QFontDatabase::findFont(QFont::Script, QFontPrivate const*, QFontDef const&, int)+0x1d5)[0x40cf1cd5]
 ||   |       \+- 153670/139 libqt-mt.so.3(QFontDatabase::findFont(QFont::Script, QFontPrivate const*, QFontDef const&, int)+0xe1d)[0x40cf291d]
 ||   |        \+- 146414/61 libqt-mt.so.3[0x40cec76c]
 ||   |         \+- 146324/60 libXft.so.2(XftFontOpenPattern+0x4a)[0x411bb25a]
 ||   |          \+- 111896/59 libXft.so.2(XftFontOpenInfo+0xef)[0x411bad1f]
 ||   |           \+- 111896/59 libXft.so.2[0x411ba794]
 ||   |            \+- 111896/59 libfreetype.so.6(FT_New_Face+0x48)[0x41221ce8]
 ||   |             \+- 111596/53 libfreetype.so.6(FT_Open_Face+0x196)[0x41220fa6]
 ||   |              \- 111216/51 libfreetype.so.6[0x412207cf]
 ||   \+- 302421/13402 libkatepart.so(KateFactoryPublic::createPartObject(QWidget*, char const*, QObject*, char const*, char const*, QStringList const&)+0x49)[0x41b7cf09]
 ||    \+- 301473/13401 libkatepart.so(KateFactory::createPartObject(QWidget*, char const*, QObject*, char const*, char const*, QStringList const&)+0x13a)[0x41b6c39a]
 ||     \+- 236279/10226 libkatepart.so(KateDocument::KateDocument(bool, bool, bool, QWidget*, char const*, QObject*, char const*)+0xa36)[0x41b6bf96]
 ||      \+- 236247/10225 libkatepart.so(KateDocument::internalSetHlMode(unsigned int)+0x22)[0x41b59452]
 ||       \+- 236047/10223 libkatepart.so(HlManager::self()+0x4b)[0x41b0c20b]
 ||        \+- 136857/6738 libkatepart.so(HlManager::HlManager()+0xd7)[0x41b0bc27]
 ||         \+- 136510/6726 libkdecore.so.4(KConfig::KConfig(QString const&, bool, bool, char const*)+0xa1)[0x4097fe11]
 ||          \+- 136412/6721 libkdecore.so.4(KConfig::reparseConfiguration()+0x134)[0x408e9554]
 ||           \+- 136397/6719 libkdecore.so.4(KConfigBase::parseConfigFiles()+0x48)[0x409704d8]
 ||            \- 136397/6719 libkdecore.so.4(KConfigINIBackEnd::parseConfigFiles()+0x28a)[0x4097ee5a]
 |++- 306650/7502 libkdeinit_kwrite.so(KWrite::KWrite(KTextEditor::Document*)+0x12b)[0x401d797b]
 ||\- 306226/7498 libkatepart.so(KateDocument::createView(QWidget*, char const*)+0x45)[0x41b6b525]
 |++- 144581/5117 libkdeinit_kwrite.so(KWrite::KWrite(KTextEditor::Document*)+0x284)[0x401d7ad4]
 ||\+- 143580/5074 libkdeui.so.4(KXMLGUIFactory::addClient(KXMLGUIClient*)+0x360)[0x407a3650]
 || \+- 143580/5074 libkdeui.so.4(KXMLGUI::BuildHelper::build(QDomElement const&)+0x5f)[0x4070298f]
 ||  \+- 143580/5074 libkdeui.so.4(KXMLGUI::BuildHelper::processElement(QDomElement const&)+0x273)[0x40702893]
 ||   \+- 143580/5074 libkdeui.so.4(KXMLGUI::BuildHelper::processContainerElement(QDomElement const&, QString const&, QString const&)+0x8e)[0x40702a7e]
 ||    \+- 143580/5074 libkdeui.so.4(KXMLGUI::BuildHelper::build(QDomElement const&)+0x5f)[0x4070298f]
 ||     \+- 107519/3681 libkdeui.so.4(KXMLGUI::BuildHelper::processElement(QDomElement const&)+0x273)[0x40702893]
 ||      \+- 105896/3626 libkdeui.so.4(KXMLGUI::BuildHelper::processContainerElement(QDomElement const&, QString const&, QString const&)+0x8e)[0x40702a7e]
 ||       \- 105896/3626 libkdeui.so.4(KXMLGUI::BuildHelper::build(QDomElement const&)+0x5f)[0x4070298f]
 |\- 113431/3866 libkdeinit_kwrite.so(KWrite::KWrite(KTextEditor::Document*)+0x261)[0x401d7ab1]
 \+- 1216824/36597 libkdeinit_kwrite.so(kdemain+0x6e5)[0x401d87c5]
  ++- 1085088/31964 libkdecore.so.4(KApplication::KApplication(bool, bool)+0x4e)[0x409cbb3e]
  |\+- 1085076/31963 libqt-mt.so.3(QApplication::QApplication(int&, char**, bool)+0x70)[0x40cce810]
  | \+- 1075148/31881 libqt-mt.so.3(QApplication::construct(int&, char**, QApplication::Type)+0x78)[0x40cce4a8]
  |  \+- 1075148/31881 libqt-mt.so.3(qt_init(int*, char**, QApplication::Type)+0x36)[0x40c62e96]
  |   ++- 527337/4641 libqt-mt.so.3(qt_init_internal(int*, char**, _XDisplay*, unsigned long, unsigned long)+0x1bd4)[0x40c61c54]
  |   |\+- 527325/4640 libXft.so.2(XftInit+0x3b)[0x411b8fab]
  |   | \+- 527325/4640 libfontconfig.so.1(FcInit+0x2c)[0x411d6f1c]
  |   |  \+- 513150/3600 libfontconfig.so.1(FcInitLoadConfigAndFonts+0x2c)[0x411d6e1c]
  |   |   \+- 513138/3599 libfontconfig.so.1(FcConfigBuildFonts+0x87)[0x411d1037]
  |   |    \+- 502711/3561 libfontconfig.so.1(FcDirScanConfig+0x68)[0x411d4328]
  |   |     \+- 502711/3561 libfontconfig.so.1(FcDirCacheReadDir+0x13c)[0x411cd88c]
  |   |      \+- 407282/3158 libfontconfig.so.1[0x411cd64e]
  |   |       ++- 268826/1052 libfontconfig.so.1(FcPatternFreeze+0x26c)[0x411dc94c]
  |   |       |\+- 268826/1052 libc.so.6(malloc+0x35)[0x415882e5]
  |   |       | \- 268826/1052 libktrace.so[0x400190f9]
  |   |       \+- 135519/1999 libfontconfig.so.1(FcPatternFreeze+0x350)[0x411dca30]
  |   |        \+- 135519/1999 libc.so.6(malloc+0x35)[0x415882e5]
  |   |         \- 135519/1999 libktrace.so[0x400190f9]
  |   \+- 374582/23571 libqt-mt.so.3(qt_init_internal(int*, char**, _XDisplay*, unsigned long, unsigned long)+0x11c6)[0x40c61246]
  |    \+- 374582/23571 libX11.so.6(XRegisterIMInstantiateCallback+0x58)[0x4130fb38]
  |     \+- 373738/23566 libX11.so.6[0x4134178d]
  |      \+- 325236/23229 ximcp.so.2(_XimRegisterIMInstantiateCallback+0x11e)[0x4169e3ce]
  |       \+- 325236/23229 libqt-mt.so.3[0x40c638c7]
  |        \+- 325236/23229 libqt-mt.so.3(QApplication::create_xim()+0x34)[0x40c63674]
  |         \+- 325236/23229 libX11.so.6(XOpenIM+0x4a)[0x4130fb8a]
  |          \+- 325236/23229 libX11.so.6[0x4134189b]
  |           \+- 325014/23227 ximcp.so.2(_XimOpenIM+0x264)[0x4169e784]
  |            \+- 323770/23205 ximcp.so.2(_XimLocalOpenIM+0x27e)[0x4169f67e]
  |             \+- 237816/6606 ximcp.so.2(_XimParseStringFile+0xb3c)[0x416a123c]
  |              \+- 237816/6606 libc.so.6(malloc+0x35)[0x415882e5]
  |               \- 237816/6606 libktrace.so[0x400190f9]
  \- 131427/4616 libkdecore.so.4(KApplication::KApplication(bool, bool)+0x221)[0x409cbd11]


More information about the Kde-optimize mailing list