Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt And Valgrind Memory Analyzer
Forum Updated to NodeBB v4.3 + New Features

Qt And Valgrind Memory Analyzer

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kabbotta
    wrote on 12 Jan 2015, 00:48 last edited by
    #1

    I'm a little confused about using valgrind with Qt Creator. I was troubled after running the analzyer on my current project to find that there were a couple hundred possible memory leaks. First, I didn't see any leaks until I turned on "External Errors". I don't quite understand that. But, also, none of the leaks seemed to point to anything I had actually written. They were all coming from the QApplication instantiation. So I decided to create a simple Widgets application and see how it did with the memory analyzer. That project also shows up a couple hundred possible memory leaks. So, are all of these leaks false positives? The more QWidgets I had to my project, the larger the list of leaks becomes, but none of them ever seem to be tied back to any of my code. They always seem to be linked specifically to the Q objects themselves.

    Here is an example of the kind of leaks it is reporting:

    @212 bytes in 1 blocks are possibly lost in loss record 6,547 of 7,114
    in main in /home/kabbotta/workspace/cpp/TimeTracker/main.cpp:10
    1: realloc in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so
    2: g_realloc in /usr/lib/libglib-2.0.so.0.4200.1
    3: g_realloc_n in /usr/lib/libglib-2.0.so.0.4200.1
    4: /usr/lib/libgobject-2.0.so.0.4200.1
    5: /usr/lib/libgobject-2.0.so.0.4200.1
    6: g_type_register_static in /usr/lib/libgobject-2.0.so.0.4200.1
    7: g_enum_register_static in /usr/lib/libgobject-2.0.so.0.4200.1
    8: gtk_tree_view_grid_lines_get_type in /usr/lib/libgtk-x11-2.0.so.0.2400.25
    9: /usr/lib/libgtk-x11-2.0.so.0.2400.25
    10: g_type_class_ref in /usr/lib/libgobject-2.0.so.0.4200.1
    11: g_object_newv in /usr/lib/libgobject-2.0.so.0.4200.1
    12: g_object_new in /usr/lib/libgobject-2.0.so.0.4200.1
    13: gtk_tree_view_new in /usr/lib/libgtk-x11-2.0.so.0.2400.25
    14: /usr/lib/libQt5Widgets.so.5.4.0
    15: /usr/lib/libQt5Widgets.so.5.4.0
    16: /usr/lib/libQt5Widgets.so.5.4.0
    17: /usr/lib/libQt5Widgets.so.5.4.0
    18: QStyleFactory::create(QString const&) in /usr/lib/libQt5Widgets.so.5.4.0
    19: QApplication::style() in /usr/lib/libQt5Widgets.so.5.4.0
    20: QApplicationPrivate::initialize() in /usr/lib/libQt5Widgets.so.5.4.0
    21: QApplicationPrivate::construct() in /usr/lib/libQt5Widgets.so.5.4.0
    22: QApplication::QApplication(int&, char**, int) in /usr/lib/libQt5Widgets.so.5.4.0
    23: main in /home/kabbotta/workspace/cpp/TimeTracker/main.cpp:10
    @

    Line 10 in main.cpp is the line where I instantiate the QApplication object.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ckakman
      wrote on 12 Jan 2015, 19:33 last edited by
      #2

      Hi,

      It looks like "dealing":http://doc.qt.io/qtcreator/creator-analyzer.html#suppressing-errors with errors from used libraries is something users need to take care of.

      1 Reply Last reply
      0

      1/2

      12 Jan 2015, 00:48

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved