Bug 256885 - memory leak around 200k in KLocalePrivate::formatDate
Summary: memory leak around 200k in KLocalePrivate::formatDate
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: klocale (show other bugs)
Version: SVN
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: John Layt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-14 12:52 UTC by Jaime Torres
Modified: 2011-08-31 15:43 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaime Torres 2010-11-14 12:52:38 UTC
Version:           SVN (using Devel) 
OS:                Linux

Valgrind tells:

==29117== 85,762 (2,496 direct, 83,266 indirect) bytes in 104 blocks are definitely lost in loss record 1,634 of 1,636
==29117==    at 0x4C26FC7: operator new(unsigned long) (vg_replace_malloc.c:261)
==29117==    by 0x7E83A52: KCalendarSystem::create(QString const&, KSharedPtr<KSharedConfig>, KLocale const*) (kcalendarsystem.cpp:64)
==29117==    by 0x7E83E83: KCalendarSystem::create(QString const&, KLocale const*) (kcalendarsystem.cpp:49)
==29117==    by 0x7EA5689: KDateTimeFormatter::formatDateTimePosix(KDateTime const&, QString const&, QFlags<KLocale::TimeFormatOption>, KCalendarSystem const*, KLocale const*, KLocale::DigitSet, KLocale::DateTimeFormatStandard) const (kdatetimeformatter.cpp:134)
==29117==    by 0x7EA2106: KDateTimeFormatter::formatDateTime(KDateTime const&, QString const&, QFlags<KLocale::TimeFormatOption>, KCalendarSystem const*, KLocale const*, KLocale::DigitSet, KLocale::DateTimeFormatStandard) const (kdatetimeformatter.cpp:90)
==29117==    by 0x7EA14AB: KDateTimeFormatter::formatDate(QDate const&, QString const&, KCalendarSystem const*, KLocale const*, KLocale::DigitSet, KLocale::DateTimeFormatStandard) const (kdatetimeformatter.cpp:54)
==29117==    by 0x7E82C07: KCalendarSystem::formatDate(QDate const&, QString const&, KLocale::DigitSet, KLocale::DateTimeFormatStandard) const (kcalendarsystem.cpp:1935)
==29117==    by 0x7E82C8F: KCalendarSystem::formatDate(QDate const&, QString const&, KLocale::DateTimeFormatStandard) const (kcalendarsystem.cpp:1923)
==29117==    by 0x7E83336: KCalendarSystem::formatDate(QDate const&, KLocale::DateFormat) const (kcalendarsystem.cpp:1914)
==29117==    by 0x7E88D58: KCalendarSystemGregorian::formatDate(QDate const&, KLocale::DateFormat) const (kcalendarsystemgregorian.cpp:527)
==29117==    by 0x7F61943: KLocalePrivate::formatDate(QDate const&, KLocale::DateFormat) (klocale_kde.cpp:1680)
==29117==    by 0x7F60E10: KLocale::formatDate(QDate const&, KLocale::DateFormat) const (klocale.cpp:370)
==29117==
==29117== 134,474 (7,488 direct, 126,986 indirect) bytes in 156 blocks are definitely lost in loss record 1,635 of 1,636
==29117==    at 0x4C26FC7: operator new(unsigned long) (vg_replace_malloc.c:261)
==29117==    by 0x7E89F64: KCalendarSystemGregorian::KCalendarSystemGregorian(KSharedPtr<KSharedConfig>, KLocale const*) (kcalendarsystemgregorian.cpp:175)
==29117==    by 0x7E83A63: KCalendarSystem::create(QString const&, KSharedPtr<KSharedConfig>, KLocale const*) (kcalendarsystem.cpp:64)
==29117==    by 0x7E83E83: KCalendarSystem::create(QString const&, KLocale const*) (kcalendarsystem.cpp:49)
==29117==    by 0x7EA5689: KDateTimeFormatter::formatDateTimePosix(KDateTime const&, QString const&, QFlags<KLocale::TimeFormatOption>, KCalendarSystem const*, KLocale const*, KLocale::DigitSet, KLocale::DateTimeFormatStandard) const (kdatetimeformatter.cpp:134)
==29117==    by 0x7EA2106: KDateTimeFormatter::formatDateTime(KDateTime const&, QString const&, QFlags<KLocale::TimeFormatOption>, KCalendarSystem const*, KLocale const*, KLocale::DigitSet, KLocale::DateTimeFormatStandard) const (kdatetimeformatter.cpp:90)
==29117==    by 0x7EA14AB: KDateTimeFormatter::formatDate(QDate const&, QString const&, KCalendarSystem const*, KLocale const*, KLocale::DigitSet, KLocale::DateTimeFormatStandard) const (kdatetimeformatter.cpp:54)
==29117==    by 0x7E82C07: KCalendarSystem::formatDate(QDate const&, QString const&, KLocale::DigitSet, KLocale::DateTimeFormatStandard) const (kcalendarsystem.cpp:1935)
==29117==    by 0x7E82C8F: KCalendarSystem::formatDate(QDate const&, QString const&, KLocale::DateTimeFormatStandard) const (kcalendarsystem.cpp:1923)
==29117==    by 0x7E83336: KCalendarSystem::formatDate(QDate const&, KLocale::DateFormat) const (kcalendarsystem.cpp:1914)
==29117==    by 0x7E88D58: KCalendarSystemGregorian::formatDate(QDate const&, KLocale::DateFormat) const (kcalendarsystemgregorian.cpp:527)
==29117==    by 0x7F61943: KLocalePrivate::formatDate(QDate const&, KLocale::DateFormat) (klocale_kde.cpp:1680)


Reproducible: Always

Steps to Reproduce:
valgrind kate
valgrind kolourpaint



Expected Results:  
No lost memory.
Comment 1 John Layt 2010-11-15 13:30:41 UTC
Looking at now.
Comment 2 John Layt 2010-11-15 13:57:32 UTC
SVN commit 1197335 by jlayt:

Fix a memory leak.

Must learn how to do this grinding myself, can you check this fixed it Jaime?

CCBUG: 256885



 M  +2 -0      kdatetimeformatter.cpp  
 M  +1 -1      klocalizeddate.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1197335
Comment 3 Jaime Torres 2010-11-16 20:09:13 UTC
Yes, the leak is fixed, but doing

valgrind --trace-children=yes --leak-check=full --tool=memcheck ./kcalendartest
(in the kdelibs/kdecore/tests build folder), there are a lot of

jump or move depends on uninitialised value(s)

two examples:
==9009== Conditional jump or move depends on uninitialised value(s)
==9009==    at 0x5151F4A: KCalendarSystemGregorian::isValid(int, int, int) const (kcalendarsystemgregorian.cpp:221)
==9009==    by 0x5149B59: KCalendarSystem::setDate(QDate&, int, int, int) const (kcalendarsystem.cpp:1056)
==9009==    by 0x4220D7: KCalendarTest::testKLocalizedDate() (kcalendartest.cpp:2583)
==9009==    by 0x42E676: KCalendarTest::qt_metacall(QMetaObject::Call, int, void**) (kcalendartest.moc:175)
==9009==    by 0x5E92A20: QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (qmetaobject.cpp:1578)
==9009==    by 0x5E93656: QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (qmetaobject.cpp:1151)
==9009==    by 0x555C0DE: QTest::qInvokeTestMethod(char const*, char const*) (qobjectdefs.h:408)
==9009==    by 0x555D1BA: QTest::qExec(QObject*, int, char**) (qtestcase.cpp:1499)
==9009==    by 0x42C01C: main (kcalendartest.cpp:19)

==9009== Conditional jump or move depends on uninitialised value(s)
==9009==    at 0x5DAE5D6: QDate::isValid(int, int, int) (qdatetime.cpp:1315)
==9009==    by 0x5149B59: KCalendarSystem::setDate(QDate&, int, int, int) const (kcalendarsystem.cpp:1056)
==9009==    by 0x4220D7: KCalendarTest::testKLocalizedDate() (kcalendartest.cpp:2583)
==9009==    by 0x42E676: KCalendarTest::qt_metacall(QMetaObject::Call, int, void**) (kcalendartest.moc:175)
==9009==    by 0x5E92A20: QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (qmetaobject.cpp:1578)
==9009==    by 0x5E93656: QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (qmetaobject.cpp:1151)
==9009==    by 0x555C0DE: QTest::qInvokeTestMethod(char const*, char const*) (qobjectdefs.h:408)
==9009==    by 0x555D1BA: QTest::qExec(QObject*, int, char**) (qtestcase.cpp:1499)
==9009==    by 0x42C01C: main (kcalendartest.cpp:19)
Comment 4 Jaime Torres 2011-08-31 15:43:53 UTC
The uninitialized values messages are gone in kdelibs branch 4.7.