Performance tips updated

Lubos Lunak l.lunak at suse.cz
Tue Oct 12 16:11:16 CEST 2004


On Tuesday 12 of October 2004 13:54, Waldo Bastian wrote:
> On Monday 11 October 2004 19:01, Lubos Lunak wrote:
> > > And another thought: konqys memory usage can grow quite high when
> > > browsing the web and having a lot of tabs open. Since free() doesn't
> > > give the memory back to the OS, the memory stays used even if you close
> > > all the tabs. So from time to time it helps to really terminate some
> > > konqy processes (as opposed to reusing preloaded ones).
> >
> >  free() gives back, but only if it has a block that is large enough,
> > which doesn't happen if the memory gets fragmented. And while Konqueror
> > tries to check its memory usage, I don't know how to protect against it
> > :(.
>
> On Linux you could maybe check VmRSS?

 I guess that's the only somewhat reasonable way. The fun comes when it comes 
to deciding what exactly to use. /proc/*/stat is undocumented, /proc/*/statm 
is documented, but it's wrong. Also, some of the values don't seem to match 
between the various files.

 Probably parsing /proc/*/status will be the best way. Say, checking that the 
increase of VmSize is no more than .... 16MiB ?

 IMO VmSize would be the best. VmRSS doesn't include swapped out memory, and I 
think that should be included too. VmSize also includes complete memory usage 
of the process, including memory used by the mmap-ed binaries of the plugins 
and so. So of those actually may be shared with other KDE applications, but 
it's probably better to count them all rather than not counting them. E.g. if 
one previews ps in Konqueror using the KGhostView part, there probably won't 
be any other application using the same part as well.

 I'm not sure about the memory difference. I just tried showing a couple of 
WWW pages, my $HOME directory, previewed image using the Gwenview KPart, and 
the usage went up from initial VmSize of 36,5MiB to 49MiB (12,5 diff), and 
after that it doesn't seem to go up too much. Checking only the malloc() 
usage gives only slightly more than 5MiB difference BTW.

 Unless there are better ideas, I'll commit this change. People using other 
platforms are of course free to send in patches for current_memory_usage() in 
kdebase/konqueror/konq_mainwindow.cc .

-- 
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/


More information about the Kde-optimize mailing list