Bug 223488

Summary: Test and fix memory usage and speed for opening a folder and populating the message list
Product: [Applications] kmail2 Reporter: Thomas McGuire <mcguire>
Component: miscAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: kde-bugs, nicksanders11, smartins, thomas, tokoe
Priority: LO Keywords: akonadi-ports-regression
Version: 1.99.0   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 223438    

Description Thomas McGuire 2010-01-19 22:17:05 UTC
Right now, when opening a folder a populating the message list, all headers of the messages are fetched and put into a KMime::Message object.

This is way too expensive, and will show as speed, disk space and memory problems.

Instead, only the headers that are really needed should be cached and loaded, which are those displayed in the message list. And there shouldn't be a big KMime::Message object for each of those, but some more memory efficient structure. Same goes for the cache in Akonadi, it should not store the complete header in plain text there.
In the same vein, the IMAP resource should not fetch the complete header, but only the needed header fields, which is possible with the IMAP protocol (and e.g. tinymail does that).

This needs to be fixed at several levels, not just KMail.
Comment 1 Björn Ruberg 2010-04-05 23:35:14 UTC
*** Bug 233138 has been marked as a duplicate of this bug. ***
Comment 2 Tobias Koenig 2010-12-12 16:56:55 UTC
Hej,

this should be fixed now. Can you reproduce?

Ciao,
Tobias
Comment 3 Thomas McGuire 2010-12-24 16:46:23 UTC
> this should be fixed now. Can you reproduce?

AFAIK the messagelist still loads a KMime::Message object for each item, and the server sends the complete header instead of only the fields that are needed.

The message list stores a tree of MessageItem's, and MessageItem::Private contains the complete Akonadi::Item, which includes the KMime::Message object.

On the Akonadi server, we store the complete header in the cache as well, which is also a waste of space and bandwidth.
Comment 4 Philipp Schmidt 2011-07-13 13:22:42 UTC
As far as I can see the Problem still exists in 4.7RC1. Loading the Messages in my local folders (archive) immediately results in a very much increased memory usage of akonadi_mixedmaildir_resource (from 16MiB to 430). When browsing my DIMAP-Folders nothing of the sort happens.
Comment 5 Nick 2011-07-21 21:37:03 UTC
This is affecting me too.
After starting kontact akonadi_mixedmaildir_resource memory usage goes up to over 2G.
Comment 6 Sergio Martins 2013-07-17 11:23:28 UTC
(In reply to comment #5)
> This is affecting me too.
> After starting kontact akonadi_mixedmaildir_resource memory usage goes up to
> over 2G.

That's bug 260647, which has a patch in review
Comment 7 Denis Kurz 2016-09-24 18:05:19 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kmail2 (version 5.0 or later, as part of KDE Applications 15.12 or later), it gets closed in about three months.
Comment 8 Denis Kurz 2017-01-07 22:04:46 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.