Bug 184529 - Memory leak when checking for mail (IMAP)
Summary: Memory leak when checking for mail (IMAP)
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: klocale (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Chusslove Illich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-16 18:05 UTC by Tomi Junnila
Modified: 2009-02-17 10:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomi Junnila 2009-02-16 18:05:46 UTC
Version:           1.10.4 (using KDE 4.1.4)
Compiler:          gcc 4.3.2 
OS:                Linux
Installed from:    Compiled From Sources

Kmail seems to be leaking memory every time it checks for new email. I've seen its memory usage leap by 2 MB (never to be released again) in a single check, although usually the leak is slower.

I took a look at kmail with valgrind --leak-check=full, and this is the result of about a 30-45 minute run (smaller leaks skipped):

==28652== 8,839,800 bytes in 654,802 blocks are definitely lost in loss record 371 of 371
==28652==    at 0x4C2582C: operator new[](unsigned long) (vg_replace_malloc.c:274)
==28652==    by 0x4E9AA76: qstrdup(char const*) (in /usr/lib/libQtCore.so.4.4.3)
==28652==    by 0x4E8F5EA: qputenv(char const*, QByteArray const&) (in /usr/lib/libQtCore.so.4.4.3)
==28652==    by 0x61E4789: KCatalog::translateStrict(char const*) const (kcatalog.cpp:205)
==28652==    by 0x61F3B8B: KLocalePrivate::translate_priv(char const*, char const*, char const*, unsigned long, QString*, QString*)const (klocale.cpp:746)
==28652==    by 0x61F411D: KLocale::translateRaw(char const*, QString*, QString*) const (klocale.cpp:762)
==28652==    by 0x61FE656: KLocalizedStringPrivate::toString(KLocale const*) const (klocalizedstring.cpp:239)
==28652==    by 0x61FF436: KLocalizedString::toString() const (klocalizedstring.cpp:200)
==28652==    by 0x677564C: KMAcctImap::postProcessNewMail(KMFolder*) (klocalizedstring.h:568)
==28652==    by 0x67789AE: KMAcctImap::qt_metacall(QMetaObject::Call, int, void**) (kmacctimap.moc:84)
==28652==    by 0x4F94133: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.4.3)
==28652==    by 0x66E1BD1: FolderStorage::numUnreadMsgsChanged(KMFolder*) (folderstorage.moc:269)
==28652==
==28652== LEAK SUMMARY:
==28652==    definitely lost: 8,840,798 bytes in 654,815 blocks.
==28652==    indirectly lost: 4,727 bytes in 37 blocks.
==28652==      possibly lost: 1,120,613 bytes in 19,650 blocks.
==28652==    still reachable: 4,005,420 bytes in 82,370 blocks.
==28652==         suppressed: 0 bytes in 0 blocks.

My locale is (since the above has references to localization): LANG=POSIX, LANGUAGE=fi, LC_*=fi_FI.UTF-8 (except LC_COLLATE and LC_MESSAGES=POSIX). This is with an IMAP server on localhost (dovecot 1.1.4), on AMD64.

KDE is version 4:4.1.4-0ubuntu1~intrepid2, but I've compiled KDEPIM myself from sources (though the same behaviour could be observed with the wrapped packages, also with the standard packages in Ubuntu Intrepid). QT version is also visible above (4.4.3, i.e. standard Ubuntu).
Comment 1 Pino Toscano 2009-02-16 20:04:29 UTC
This should have been fixed for KDE 4.2.1.
Comment 2 Tomi Junnila 2009-02-17 10:13:14 UTC
It looks like the patch referred to by Pino (available at <http://websvn.kde.org/trunk/KDE/kdelibs/kdecore/localization/kcatalog.cpp?r1=899214&r2=918505&view=patch>) works ok: kmail no longer leaks memory when kdelibs is patched.

The patch works as-is with KDE 4.1.4 also.