Compiling and Running a Bare Application with valgrind



  • In trying to deal with another problem, I was introduced to using valgrind. I get a lot of errors in valgrind so as an experiment I decided to make a Qt application without anything added, Just what you get from Qt. Running it displays a simple blank form. Running it with valgrind produces the following output. I have difficulty understanding how a blank Qt application has all these memory leaks reported by valgrind. Does this make sense to anyone?

    bbb_developer@bbb-vm:~/workspace/build-GVP2-Desktop_Qt_5_6_1_GCC_64bit-Debug$ valgrind ./GVP2
    ==4747== Memcheck, a memory error detector
    ==4747== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==4747== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
    ==4747== Command: ./GVP2
    ==4747== 
    ==4747== Conditional jump or move depends on uninitialised value(s)
    ==4747==    at 0x11CEE13D: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x714B1D3: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x71659A5: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x7166554: g_signal_emit_by_name (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x71528F7: g_object_set_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x7152FCB: g_object_set (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x50737A5: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x4FFCD2C: QStyleFactory::create(QString const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x4F92363: QApplication::style() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x4F925C4: QApplicationPrivate::initialize() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x4F92613: QApplicationPrivate::init() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x40274D: main (main.cpp:6)
    ==4747== 
    ==4747== Conditional jump or move depends on uninitialised value(s)
    ==4747==    at 0x78113F8: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x11CF1734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF1D38: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF206E: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x714AFA4: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x715CAFB: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x7165D5B: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x716608E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x11E80B53: gtk_widget_realize (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11E81E67: gtk_widget_set_parent (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11D20A32: gtk_fixed_put (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x714E0A6: g_cclosure_marshal_VOID__OBJECTv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747== 
    ==4747== Conditional jump or move depends on uninitialised value(s)
    ==4747==    at 0x7811425: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x11CF1734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF1D38: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF206E: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x714AFA4: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x715CAFB: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x7165D5B: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x716608E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747==    by 0x11E80B53: gtk_widget_realize (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11E81E67: gtk_widget_set_parent (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11D20A32: gtk_fixed_put (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x714E0A6: g_cclosure_marshal_VOID__OBJECTv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
    ==4747== 
    ==4747== Conditional jump or move depends on uninitialised value(s)
    ==4747==    at 0x78113F8: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x11CF1734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF1D38: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF1E47: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x12298D56: ??? (in /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x77E2059: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x77E23FF: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x77E24AB: g_main_context_iteration (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x596E176: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x591CBC9: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x5924A5C: QCoreApplication::exec() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x40276F: main (main.cpp:10)
    ==4747== 
    ==4747== Conditional jump or move depends on uninitialised value(s)
    ==4747==    at 0x7811425: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x11CF1734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF1D38: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF1E47: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x12298D56: ??? (in /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x77E2059: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x77E23FF: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x77E24AB: g_main_context_iteration (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x596E176: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x591CBC9: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x5924A5C: QCoreApplication::exec() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x40276F: main (main.cpp:10)
    ==4747== 
    ==4747== Conditional jump or move depends on uninitialised value(s)
    ==4747==    at 0x78113F8: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x11CF1734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF1E71: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x12298D56: ??? (in /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x77E2059: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x77E23FF: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x77E24AB: g_main_context_iteration (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x596E176: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x591CBC9: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x5924A5C: QCoreApplication::exec() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x40276F: main (main.cpp:10)
    ==4747== 
    ==4747== Conditional jump or move depends on uninitialised value(s)
    ==4747==    at 0x7811425: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x11CF1734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x11CF1E71: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x12298D56: ??? (in /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.30)
    ==4747==    by 0x77E2059: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x77E23FF: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x77E24AB: g_main_context_iteration (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
    ==4747==    by 0x596E176: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x591CBC9: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x5924A5C: QCoreApplication::exec() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747==    by 0x40276F: main (main.cpp:10)
    ==4747== 
    ==4747== Syscall param writev(vector[...]) points to uninitialised byte(s)
    ==4747==    at 0x645973D: ??? (syscall-template.S:84)
    ==4747==    by 0xB043F28: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
    ==4747==    by 0xB04431C: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
    ==4747==    by 0xB044A76: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
    ==4747==    by 0xB044C43: xcb_flush (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
    ==4747==    by 0xE12124F: QXcbWindow::hide() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
    ==4747==    by 0x6829AC0: QWindow::setVisible(bool) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
    ==4747==    by 0x4FC901E: QWidgetPrivate::hide_sys() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x4FCF15C: QWidgetPrivate::hide_helper() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x4FD3847: QWidget::setVisible(bool) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x4FCF497: QWidgetPrivate::close_helper(QWidgetPrivate::CloseMode) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==    by 0x4FEEAD5: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
    ==4747==  Address 0xd16a1f9 is 4,537 bytes inside a block of size 21,152 alloc'd
    ==4747==    at 0x4C2F988: calloc (vg_replace_malloc.c:711)
    ==4747==    by 0xB0438DB: xcb_connect_to_fd (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
    ==4747==    by 0xB047610: xcb_connect_to_display_with_auth_info (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
    ==4747==    by 0x7CF7809: _XConnectXCB (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
    ==4747==    by 0x7CE8391: XOpenDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
    ==4747==    by 0xE10C26A: QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
    ==4747==    by 0xE10FC0A: QXcbIntegration::QXcbIntegration(QStringList const&, int&, char**) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
    ==4747==    by 0xDECB3EA: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/plugins/platforms/libqxcb.so)
    ==4747==    by 0x680CE5A: QPlatformIntegrationFactory::create(QString const&, QStringList const&, int&, char**, QString const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
    ==4747==    by 0x6819FEB: QGuiApplicationPrivate::createPlatformIntegration() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
    ==4747==    by 0x681ABCC: QGuiApplicationPrivate::createEventDispatcher() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
    ==4747==    by 0x592487C: QCoreApplicationPrivate::init() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
    ==4747== 
    ==4747== 
    ==4747== HEAP SUMMARY:
    ==4747==     in use at exit: 1,988,345 bytes in 21,003 blocks
    ==4747==   total heap usage: 110,657 allocs, 89,654 frees, 16,194,990 bytes allocated
    ==4747== 
    ==4747== LEAK SUMMARY:
    ==4747==    definitely lost: 3,291 bytes in 8 blocks
    ==4747==    indirectly lost: 26,149 bytes in 628 blocks
    ==4747==      possibly lost: 4,396 bytes in 30 blocks
    ==4747==    still reachable: 1,671,941 bytes in 19,096 blocks
    ==4747==                       of which reachable via heuristic:
    ==4747==                         length64           : 7,880 bytes in 116 blocks
    ==4747==                         newarray           : 2,112 bytes in 52 blocks
    ==4747==         suppressed: 0 bytes in 0 blocks
    ==4747== Rerun with --leak-check=full to see details of leaked memory
    ==4747== 
    ==4747== For counts of detected and suppressed errors, rerun with: -v
    ==4747== Use --track-origins=yes to see where uninitialised values come from
    ==4747== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
    
    

  • Moderators

    @mstoth I think this is normal: you often get complains from Valgrind about issues in system libraries or Qt in this case. You can just ignore them. See http://doc.qt.io/qtcreator/creator-analyzer.html#suppressing-errors


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.