[Kde-pim] KMail Memory Report

Milian Wolff mail at milianw.de
Tue Nov 18 12:07:06 GMT 2014


Hey all,

I played around with heaptrack [1] some more recently and looked at KMail 
again. See these reports:

1) hotspots by peak memory consumption:
https://userpage.physik.fu-berlin.de/~milianw/kmail.peaks.log

2) hotspots by "merged" peak memory consumption:
(this groups backtraces that point to the same leaf node, thus all backtraces 
that call e.g. QString::realloc are seen as one "peak". there algorithm 
currently does not take time into account properly though, which is why the 
results might be wrong. still interesting imo)
https://userpage.physik.fu-berlin.de/~milianw/kmail.peaks.merged.log

3) hotspots by number of calls to malloc & friends:
https://userpage.physik.fu-berlin.de/~milianw/kmail.allocations.log

1) and 3) I showed you before, nothing much has changed there. Akonadi::Item 
is still large and KMime::HeaderParsing still inefficient. I proposed some 
ideas before on how to tackle these issues, and I still plan to do that 
eventually. Are there by now news on the improved streaming interface to 
Akonadi which gets rid of all the silly string parsing etc.?

But more interesting today is imo 2) as it spots some issues in the public 
API. I hope these things get fixed before a first KF5 based KDEPIM is released 
with ABI stability guarantee: Don't use QList by default! KDEPIM source code 
and public API is riddled with this container class. But read this e.g.: 
http://marcmutz.wordpress.com/effective-qt/containers/

QList should not be your container of choice **by default**!

Why? Take a look at 2) and search for QListData::detach_grow. 
KMime::Types::Mailbox, ::AddrSpec, ::Address, ... etc are all larger than 
sizeof(uintptr_t). Thus QList will allocate each individual Mailbox entry on 
the heap! Using QVector and marking the Mailbox as Q_MOVABLE_TYPE will make 
this much more efficient (better cache locality, less calls to malloc calls, 
less chance of fragmentation issues).

Please take this into account in the current effort of creating a KF5 based 
KDEPIM.

Cheers!

[1]: http://quickgit.kde.org/?p=scratch%2Fmwolff%2Fheaptrack.git
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list