LeakTracer2.3 valgrind1.0.4 QT3.0.6 KDE3.0.5

LeakTracer2.3 valgrind1.0.4 QT3.0.6 KDE3.0.5

Post by Uli Laub » Sat, 07 Dec 2002 01:38:06



Hi all.

I am currently doing my first steps with Qt/KDE-programming. I consider myself a chaotic programmer, so I started hunting memory leaks im my code.
First I tried LeakTracer2.3 but I didn't discover any leaks. Ok, I thought for myself, this tool is a little older, perhaps it is not working with my
compiler/linker/libloader whatever. So I switched to valgrind.

After compiling the libqt-mt.so with debug support I build my app with  -g  and linked via  -Wl,-rpath  against the previously build debug version of
the Qt-lib and started the whole thing with:

valgrind -v --leak-check=yes sindbad

==3930== valgrind-1.0.4, a memory error detector for x86 GNU/Linux.
==3930== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
[a lot Reading sym msgs]
==3930== Estimated CPU clock rate is 551 MHz
[more Reading sym msgs]
[two msg they are repeated below]
[now I started working with my app]
[after I while I closed my app]
==3930== ERROR SUMMARY: 11 errors from 2 contexts (suppressed: 135 from 6)
==3930==
==3930== 1 errors in context 1 of 2:
==3930== Conditional jump or move depends on uninitialised value(s)
==3930==    at 0x410A556A: XftFreeTypeSetFace (in /usr/X11R6/lib/libXft.so.1.1)
==3930==    by 0x410A5B4E: XftFreeTypeOpen (in /usr/X11R6/lib/libXft.so.1.1)
==3930==    by 0x4042CFC3: QFontPrivate::load(QFont::Script, bool) (kernel/qfont_x11.cpp:2648)
==3930==    by 0x4042C72D: QFontPrivate::loadUnicode(QFont::Script, QChar const&) (kernel/qfont_x11.cpp:2406)
==3930==
==3930== 10 errors in context 2 of 2:
==3930== Syscall param write(buf) contains uninitialised or unaddressable byte(s)
==3930==    at 0x40E85AD4: __libc_write (in /lib/libc.so.6)
==3930==    by 0x40F7F73F: _IceTransWrite (in /usr/X11R6/lib/libICE.so.6.3)
==3930==    by 0x40F76389: _IceWrite (in /usr/X11R6/lib/libICE.so.6.3)
==3930==    by 0x40F75FA2: IceFlush (in /usr/X11R6/lib/libICE.so.6.3)
==3930==    Address 0x45ADE59F is 3 bytes inside a block of size 1024 alloc'd
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x40F7341D: IceOpenConnection (in /usr/X11R6/lib/libICE.so.6.3)
==3930==    by 0x40F683A9: SmcOpenConnection (in /usr/X11R6/lib/libSM.so.6.0)
==3930==    by 0x40415062: QSessionManager::QSessionManager(QApplication*, QString&) (kernel/qapplication_x11.cpp:6463)
--3930--
--3930-- supp:    7 writev(vector[...])/__writev/libX11.so.6.2/libX11.so.6.2
--3930-- supp:   36 write(buf)/__libc_write/libX11.so.6.2/libX11.so.6.2(Param)
--3930-- supp:    4 __pthread_mutex_unlock/_IO_funlockfile
--3930-- supp:   81 pthread_error/__pthread_mutex_destroy/_IO_default_finish
--3930-- supp:    5 pthread_error/__pthread_mutex_destroy/__closedir
--3930-- supp:    2 __libc_freeres/free_mem/free(Free)
==3930==
==3930== IN SUMMARY: 11 errors from 2 contexts (suppressed: 135 from 6)
==3930==
==3930== malloc/free: in use at exit: 449177 bytes in 9692 blocks.
==3930== malloc/free: 453133 allocs, 443443 frees, 11138833 bytes allocated.
==3930==
==3930== searching for pointers to 9692 not-freed blocks.
==3930== checked 21800348 bytes.
==3930==
==3930== definitely lost: 889 bytes in 36 blocks.
==3930== possibly lost:   2996 bytes in 2 blocks.
==3930== still reachable: 445292 bytes in 9654 blocks.
==3930==
==3930== 4 bytes in 1 blocks are definitely lost in loss record 8 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x41126046: (within /opt/kde3/lib/libDCOP.so.4.0.0)
==3930==    by 0x41126478: _KDE_IceProcessCoreMessage (in /opt/kde3/lib/libDCOP.so.4.0.0)
==3930==    by 0x411224E4: KDE_IceProcessMessages (in /opt/kde3/lib/libDCOP.so.4.0.0)
==3930==
==3930== 4 bytes in 1 blocks are definitely lost in loss record 9 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x41125FE4: (within /opt/kde3/lib/libDCOP.so.4.0.0)
==3930==    by 0x41126478: _KDE_IceProcessCoreMessage (in /opt/kde3/lib/libDCOP.so.4.0.0)
==3930==    by 0x411224E4: KDE_IceProcessMessages (in /opt/kde3/lib/libDCOP.so.4.0.0)
==3930==
==3930== 16 bytes in 1 blocks are definitely lost in loss record 31 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x40FCE913: NewDatabase (in /usr/X11R6/lib/libX11.so.6.2)
==3930==    by 0x40FD07CC: XrmGetStringDatabase (in /usr/X11R6/lib/libX11.so.6.2)
==3930==    by 0x40FB33C8: InitDefaults (in /usr/X11R6/lib/libX11.so.6.2)
==3930==
==3930== 16 bytes in 1 blocks are definitely lost in loss record 35 of 136
==3930==    at 0x4003CF0B: calloc (vg_clientfuncs.c:239)
==3930==    by 0x40FBCC35: XOpenDisplay (in /usr/X11R6/lib/libX11.so.6.2)
==3930==    by 0x4040A0FD: qt_init_internal(int*, char**, _XDisplay*, unsigned long, unsigned long) (kernel/qapplication_x11.cpp:1612)
==3930==    by 0x4040B2CF: qt_init(int*, char**, QApplication::Type) (kernel/qapplication_x11.cpp:2143)
==3930==
==3930== 16 bytes in 1 blocks are definitely lost in loss record 36 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x4003CFA2: realloc (vg_clientfuncs.c:262)
==3930==    by 0x40E3C14B: __argz_append (in /lib/libc.so.6)
==3930==    by 0x40DE95F9: __newlocale (in /lib/libc.so.6)
==3930==
==3930== 59 bytes in 1 blocks are definitely lost in loss record 58 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x4645CF32: parse_fontdata (in /usr/X11R6/lib/X11/locale/lib/common/xomGeneric.so.2)
==3930==    by 0x4645D20C: parse_vw (in /usr/X11R6/lib/X11/locale/lib/common/xomGeneric.so.2)
==3930==    by 0x4645D5A4: parse_fontname (in /usr/X11R6/lib/X11/locale/lib/common/xomGeneric.so.2)
==3930==
==3930== 104 bytes in 1 blocks are possibly lost in loss record 69 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x410A5A6C: XftFreeTypeOpen (in /usr/X11R6/lib/libXft.so.1.1)
==3930==    by 0x4042CFC3: QFontPrivate::load(QFont::Script, bool) (kernel/qfont_x11.cpp:2648)
==3930==    by 0x4042C72D: QFontPrivate::loadUnicode(QFont::Script, QChar const&) (kernel/qfont_x11.cpp:2406)
==3930==
==3930== 160 bytes in 2 blocks are definitely lost in loss record 74 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x40FB0FD5: _XF86BigfontQueryFont (in /usr/X11R6/lib/libX11.so.6.2)
==3930==    by 0x40FB0660: XLoadQueryFont (in /usr/X11R6/lib/libX11.so.6.2)
==3930==    by 0x4645BFF0: load_fontset_data (in /usr/X11R6/lib/X11/locale/lib/common/xomGeneric.so.2)
==3930==
==3930== 164 bytes in 15 blocks are definitely lost in loss record 76 of 136
==3930==    at 0x4003CB5D: __builtin_new (vg_clientfuncs.c:125)
==3930==    by 0x4003CBA2: operator new(unsigned) (vg_clientfuncs.c:139)
==3930==    by 0x806B62A: Spielfeld::slotDoZug(QValueList<int>*, std::_Rb_tree_iterator<SZug, SZug const&, SZug const*>) (gameboard.w:533)
==3930==    by 0x806A601: Spielfeld::qt_invoke(int, QUObject*) (gameboard.moc:115)
==3930==
==3930== 216 bytes in 1 blocks are definitely lost in loss record 85 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x461837A3: _XimOpenIM (in /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2)
==3930==    by 0x41007B98: _XDynamicOpenIM (in /usr/X11R6/lib/libX11.so.6.2)
==3930==    by 0x461830BF: _XimRegisterIMInstantiateCallback (in /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2)
==3930==
==3930== 234 bytes in 12 blocks are definitely lost in loss record 86 of 136
==3930==    at 0x4003CA75: malloc (vg_clientfuncs.c:100)
==3930==    by 0x4100D5B8: resolve_name (in /usr/X11R6/lib/libX11.so.6.2)
==3930==    by 0x4100DCE7: _XlcLocaleDirName (in /usr/X11R6/lib/libX11.so.6.2)
==3930==    by 0x41007EA1: _XDynamicOpenOM (in /usr/X11R6/lib/libX11.so.6.2)
==3930==
==3930== 2892 bytes in 1 blocks are possibly lost in loss record 119 of 136
==3930==    at 0x4003CC57: __builtin_vec_new (vg_clientfuncs.c:156)
==3930==    by 0x4003CC9C: operator new[](unsigned) (vg_clientfuncs.c:170)
==3930==    by 0x4069E420: QCanvas::init(int, int, int, int) (canvas/qcanvas.cpp:574)
==3930==    by 0x4069E6EC: QCanvas::QCanvas(int, int) (canvas/qcanvas.cpp:602)
==3930==
==3930== LEAK SUMMARY:
==3930==    definitely lost: 889 bytes in 36 blocks.
==3930==    possibly lost:   2996 bytes in 2 blocks.
==3930==    still reachable: 445292 bytes in 9654 blocks.
==3930== Reachable blocks (those to which a pointer was found) are not shown.
==3930== To see them, rerun with: --show-reachable=yes
==3930==
--3930--       lru: 2578 epochs, 0 clearings.
--3930-- translate: new 94209 (1538721 -> 20273671), discard 0 (0 -> 0).
--3930--  dispatch: 128900000 basic blocks, 5384/3945532 sched events, 1463892 tt_fast misses.
--3930-- reg-alloc: 35891 t-req-spill, 3604955+241331 orig+spill uis, 507520 total-reg-r.
--3930--    sanity: 3984 cheap, 160 expensive checks.

There is only one msg regarding my code! 164 bytes. Why?! I was expecting more memory leaks! I usually have the problem of figuring out wether Qt-lib,
KDE-lib or the STL calls  delete  for me or if I have to take care of it. And there are surprisingly many msg about other peoples code!

I have not much experience with valgrind, perhaps somebody with more experience in hunting memory leaks under linux-g++ could comment on this:

Is every msg by valgrind a serious flaw in the code reported? Or is it possible that vlagrind is mistaken for some reason?

Thanks in advance.

Uli Laube

 
 
 

LeakTracer2.3 valgrind1.0.4 QT3.0.6 KDE3.0.5

Post by morde » Sat, 07 Dec 2002 09:03:27



> Hi all.

> I am currently doing my first steps with Qt/KDE-programming. I consider
> myself a chaotic programmer, so I started hunting memory leaks im my

^^^^^^^^^^^^^^^^^^^^^ In this case you should stop programming in
C & C++. Use scriptable languages like Python or Tcl. Or something like
Java. Not sure if there is Qt interface in Java though. Probably not.

Unless you have a clear idea of how to manage memory in your C app the
results will be horrendous. Maybe that's why Java is popular?

 
 
 

1. Upgrading (v5.0.4->v5.0.5) information...

I have a system with v5.0.4 and I have the v5.0.5 package ready to be
installed...

The v5.0.5 is a complete package (don't know if upgrade versions exists, but
what I have is a complete one): is there anything I should know before
starting to install it ?

Since I'm not so fond of upgrading under *nix platforms, could someone just
tell me if it is a PLAIN process or a PAIN process ???

I have some applications running and would not like to shutdown the entire
system for a couple of weeks because of my stupidity... I would get fired,
instead of promoted ;-)

Thank you.

2. Swap Atomically?

3. QT3.0.5 compile problem

4. booting without video?

5. RedHat 8.0 RPMs for KDE3.0.5

6. I have grown to love cyberspace flounders :)

7. HELP: KDE3.0.4 Screensaver doesn't check password!?

8. HELP!! Java causes Netscape to crash!

9. Fwd: rpm-4.2, rpm-4.1.1, rpm-4.0.5, librpm404-4.0.5 release (finally)

10. Compiling KDE3 / QT3.0.9?

11. QT3 + KDE3 segfault (sig 11) problems...

12. compiling with qt3/KDE3

13. noteedit on KDE3/Qt3