Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-51412

Memory leak in subscribeToNotification() and unsubscribeFromNotification()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.1
    • 5.5.1
    • SQL Support
    • None
    • Debian 7 amd64,
      Qt 5.5.1 from online installer.
    • 361142b5fcd199e7c301765b0dd16227cde71080

    Description

      I've attached test case where 10k loops produce ~4MB leak (2 megs both subscribeToNotification() and unsubscribeFromNotification() each):

      ==26381== 1,996,600 bytes in 9,983 blocks are definitely lost in loss record 581 of 582
      ==26381==    at 0x4C2AB20: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==26381==    by 0x98B0ADC: PQmakeEmptyPGresult (in /usr/lib/x86_64-linux-gnu/libpq.so.5.8)
      ==26381==    by 0x98BB7B2: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.8)
      ==26381==    by 0x98B2AD7: PQgetResult (in /usr/lib/x86_64-linux-gnu/libpq.so.5.8)
      ==26381==    by 0x98B2DF7: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.8)
      ==26381==    by 0x9693828: QPSQLDriverPrivate::exec(char const*) const (qsql_psql.cpp:179)
      ==26381==    by 0x969398B: QPSQLDriverPrivate::exec(QString const&) const (qsql_psql.cpp:189)
      ==26381==    by 0x96999BB: QPSQLDriver::unsubscribeFromNotification(QString const&) (qsql_psql.cpp:1425)
      ==26381==    by 0x4015E8: main (main.cpp:27)
      ==26381== 
      ==26381== 1,997,800 bytes in 9,989 blocks are definitely lost in loss record 582 of 582
      ==26381==    at 0x4C2AB20: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==26381==    by 0x98B0ADC: PQmakeEmptyPGresult (in /usr/lib/x86_64-linux-gnu/libpq.so.5.8)
      ==26381==    by 0x98BB7B2: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.8)
      ==26381==    by 0x98B2AD7: PQgetResult (in /usr/lib/x86_64-linux-gnu/libpq.so.5.8)
      ==26381==    by 0x98B2DF7: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.8)
      ==26381==    by 0x9693828: QPSQLDriverPrivate::exec(char const*) const (qsql_psql.cpp:179)
      ==26381==    by 0x969398B: QPSQLDriverPrivate::exec(QString const&) const (qsql_psql.cpp:189)
      ==26381==    by 0x969901F: QPSQLDriver::subscribeToNotification(QString const&) (qsql_psql.cpp:1390)
      ==26381==    by 0x40159E: main (main.cpp:26)
      

      I've looked at code and I see that there are missing PQclear calls. I will push changes to gerrit.

      Attachments

        1. main.cpp
          0.7 kB
          Vincas Dargis
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mabrand Mark Brand
            talkless Vincas Dargis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes