Revision 55085b7...
Go back to digest for 24th November 2013Optimization in KDE-PIM
tree: only allocate memory for message metadata when actually needed
Previously, all messages in a mailbox would be allocated as soon as a mailbox
was opened. The data was not being loaded from the cache or fro mthe network,
but the memory was still being consumed. This patch move those data which are
not immediately needed into an auxiliary struct which is only allocated upon the
first request.
This cuts the memory usage of the testFlagReSyncBenchmark to 25 MB from 45 MB of
the old version.
What will be interesting to do is implementing periodical freeing of resources,
so that messages which are "not needed" anymore could be reclaimed. However,
that will require tracking the actual usage patterns of the individual items
which is rather hard to do -- the Qt MVC API unfortunately doesn't help here,
not even when using the persistent indexes.
v2: Release the full MessageDataPayload when freeing the per-message memory.
Thanks to Thomas Lübking for his suggestion, and shame on me for not doing this
in the first place. Train coding apparently didn't work this time.
REVIEW: 113912
File Changes
- /Imap/Model
- src/MailboxTree.cpp
- src/MailboxTree.h
- src/Model.cpp