memory leaks

Alles rund um die Programmierung mit Qt
Antworten
Mati
Beiträge: 66
Registriert: 4. Januar 2006 00:11

memory leaks

Beitrag von Mati »

Hallo,

in der Sufu wurde schon mal was dergleichen behandelt als thema nur würde ich gerne wissen wie ihr sonst so eure speicher löcher findet UND dann auch behandelt?

Benutzten die meisten wirklich valgrind ?

Gibt es da eine andere Methode?

Wie ist es bei "normalem" C++ code ohne Qt?

Ich habe nun mein qt Programm mit valgrind gestartet und ich verstehe trotz doku die ausgabe net:

Hier mal nur ein Fehler:

Code: Alles auswählen

 
==5357== Invalid read of size 4
==5357==    at 0x1C54616C: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C54658C: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C5C1FF6: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C63C422: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C63C337: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C63C6C4: __libc_freeres (in /lib/tls/libc-2.3.2.so)
==5357==    by 0x1B8FEA08: _vgw(float, long double,...)(...)(long double,...)(short) (vg_intercept.c:55)
==5357==    by 0x1C55A1C5: exit (in /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C54497D: __libc_start_main (in /lib/tls/libc-2.3.2.so)
==5357==    by 0x804FAB0: ??? (start.S:102)
==5357==  Address 0x1C925918 is 8 bytes inside a block of size 60 free'd
==5357==    at 0x1B906B04: free (vg_replace_malloc.c:152)
==5357==    by 0x1C546D37: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C605902: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C6057A6: tdestroy (in /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C63C1C1: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C63C6C4: __libc_freeres (in /lib/tls/libc-2.3.2.so)
==5357==    by 0x1B8FEA08: _vgw(float, long double,...)(...)(long double,...)(short) (vg_intercept.c:55)
==5357==    by 0x1C55A1C5: exit (in /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C54497D: __libc_start_main (in /lib/tls/libc-2.3.2.so)
==5357==    by 0x804FAB0: ??? (start.S:102)

Aber nirgendwo steht ja was von einer cpp datei meinerseits....
davor war halt ein fehler aber ich glaube nicht dass der was damit zu tun hat....

Code: Alles auswählen

==5357== Syscall param writev(vector[...]) points to uninitialised byte(s)
==5357==    at 0x1C6005E8: (within /lib/tls/libc-2.3.2.so)
==5357==    by 0x1C16BEBF: (within /usr/X11R6/lib/libX11.so.6.2)
==5357==    by 0x1C16CA8E: _X11TransWritev (in /usr/X11R6/lib/libX11.so.6.2)
==5357==    by 0x1C14D186: _XSend (in /usr/X11R6/lib/libX11.so.6.2)
==5357==    by 0x1C142683: (within /usr/X11R6/lib/libX11.so.6.2)
==5357==    by 0x1C142DCA: XPutImage (in /usr/X11R6/lib/libX11.so.6.2)
==5357==    by 0x1C0633F5: XcursorImageLoadCursor (in /usr/lib/libXcursor.so.1.0.2)
==5357==    by 0x1C0638C4: XcursorImagesLoadCursor (in /usr/lib/libXcursor.so.1.0.2)
==5357==    by 0x1C0667D9: XcursorLibraryLoadCursor (in /usr/lib/libXcursor.so.1.0.2)
==5357==    by 0x1BB27CD6: QCursorData::update() (qcursor_x11.cpp:261)
==5357==    by 0x1BB278A9: QCursor::handle() const (qcursor_x11.cpp:113)
==5357==    by 0x1BB33294: qt_x11_enforce_cursor(QWidget*) (qwidget_x11.cpp:273)
==5357==  Address 0x1C762D82 is 274 bytes inside a block of size 2048 alloc'd
==5357==    at 0x1B906F75: calloc (vg_replace_malloc.c:175)
==5357==    by 0x1C13E09C: XOpenDisplay (in /usr/X11R6/lib/libX11.so.6.2)
==5357==    by 0x1BB11C9F: qt_init(QApplicationPrivate*, int, _XDisplay*, unsigned long, unsigned long) (qapplication_x11.cpp:1423)
==5357==    by 0x1BAB0415: QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long) (qapplication.cpp:634)
==5357==    by 0x1BAAFF90: QApplication::QApplication(int&, char**) (qapplication.cpp:562)
==5357==    by 0x804FC85: main (UIMain.cpp:15)

in zeile 15 meiner UIMain.cpp steht folgendes:

Code: Alles auswählen

    QApplication app( argc, argv );
aber das kann doch nicht das Problem sein ???
Ich danke euch für eure Hilfe!
Mati
Beiträge: 66
Registriert: 4. Januar 2006 00:11

Beitrag von Mati »

Also das Programm/die Application läuft problemlos,nur valgrind meldet also die fehlermeldungen!
Ich lege NUR QT Widgets auf dem Heap ab! Nix eigenes was ich deleten müsste....
diese meldung:

Code: Alles auswählen

==5295== Syscall param writev(vector[...]) points to uninitialised byte(s)
==5295==    at 0x1C6005E8: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C16BEBF: (within /usr/X11R6/lib/libX11.so.6.2)
==5295==    by 0x1C16CA8E: _X11TransWritev (in /usr/X11R6/lib/libX11.so.6.2)
==5295==    by 0x1C14D186: _XSend (in /usr/X11R6/lib/libX11.so.6.2)
==5295==    by 0x1C142683: (within /usr/X11R6/lib/libX11.so.6.2)
==5295==    by 0x1C142DCA: XPutImage (in /usr/X11R6/lib/libX11.so.6.2)
==5295==    by 0x1C0633F5: XcursorImageLoadCursor (in /usr/lib/libXcursor.so.1.0.2)
==5295==    by 0x1C0638C4: XcursorImagesLoadCursor (in /usr/lib/libXcursor.so.1.0.2)
==5295==    by 0x1C0667D9: XcursorLibraryLoadCursor (in /usr/lib/libXcursor.so.1.0.2)
==5295==    by 0x1BB27CD6: QCursorData::update() (qcursor_x11.cpp:261)
==5295==    by 0x1BB278A9: QCursor::handle() const (qcursor_x11.cpp:113)
==5295==    by 0x1BB33294: qt_x11_enforce_cursor(QWidget*) (qwidget_x11.cpp:273)
==5295==  Address 0x1C762D82 is 274 bytes inside a block of size 2048 alloc'd
==5295==    at 0x1B906F75: calloc (vg_replace_malloc.c:175)
==5295==    by 0x1C13E09C: XOpenDisplay (in /usr/X11R6/lib/libX11.so.6.2)
==5295==    by 0x1BB11C9F: qt_init(QApplicationPrivate*, int, _XDisplay*, unsigned long, unsigned long) (qapplication_x11.cpp:1423)
==5295==    by 0x1BAB0415: QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long) (qapplication.cpp:634)
==5295==    by 0x1BAAFF90: QApplication::QApplication(int&, char**) (qapplication.cpp:562)
==5295==    by 0x804FC85: main (UIMain.cpp:15)

kommt schon beim aufruf der Anwendung.
ÜBrigens: wenn ich Beispiele von der trolltech homepage oder NUr eine leere Anwendung ausführe kommt dieser fehler auch!
dabei steht in der zeile 15 der UIMain.cpp nur

Code: Alles auswählen

QApplication app( argc, argv );
ist das ok so?


wie könnte ich eben an diese fehler rangehen, die erst NACH dem beenden der Anwendung auftreten:

Code: Alles auswählen

==5295== Invalid read of size 4
==5295==    at 0x1C54616C: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C54658C: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C5C1FF6: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C63C422: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C63C337: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C63C6C4: __libc_freeres (in /lib/tls/libc-2.3.2.so)
==5295==    by 0x1B8FEA08: _vgw(float, long double,...)(...)(long double,...)(short) (vg_intercept.c:55)
==5295==    by 0x1C55A1C5: exit (in /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C54497D: __libc_start_main (in /lib/tls/libc-2.3.2.so)
==5295==    by 0x804FAB0: ??? (start.S:102)
==5295==  Address 0x1C925918 is 8 bytes inside a block of size 60 free'd
==5295==    at 0x1B906B04: free (vg_replace_malloc.c:152)
==5295==    by 0x1C546D37: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C605902: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C6057A6: tdestroy (in /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C63C1C1: (within /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C63C6C4: __libc_freeres (in /lib/tls/libc-2.3.2.so)
==5295==    by 0x1B8FEA08: _vgw(float, long double,...)(...)(long double,...)(short) (vg_intercept.c:55)
==5295==    by 0x1C55A1C5: exit (in /lib/tls/libc-2.3.2.so)
==5295==    by 0x1C54497D: __libc_start_main (in /lib/tls/libc-2.3.2.so)
==5295==    by 0x804FAB0: ??? (start.S:102)

wäre nett wenn mir jemand helfen könnte...
Christian81
Beiträge: 7319
Registriert: 26. August 2004 14:11
Wohnort: Bremen
Kontaktdaten:

Beitrag von Christian81 »

Wenn Du hinschaust siehst Du, dass diese 'Fehler' weder in einer Qt-lib sind noch aus deinem Sourcecode stammen. Also kannst Du diese ignorieren.
MfG Christian

'Funktioniert nicht' ist keine Fehlerbeschreibung
Antworten