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

Possible QDnsLookup::lookup() memory leak

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.9.0
    • Network: DNS
    • None
    • macOS 10.12.4

    Description

      Calling the lookup method on QDnsLookup class, produces a memory leak on macOS. It was inspected with Xcode Instruments Tool and Valgrind, both with similar results.

      This simple code can reproduce the problem easily.

      #include "dnsresolver.h"
      
      DnsResolver::DnsResolver(QObject *parent) : QObject(parent)
      {
          lookup = new QDnsLookup(QDnsLookup::A, "qt.io",QHostAddress("8.8.8.8"));
          connect(lookup, SIGNAL(finished()), this, SLOT(handleLookup()));
          lookup->lookup();
      }
      
      void DnsResolver::handleLookup()
      {
          // I use sleep for letting the profiler inspect the memory trace with enough time
          QThread::sleep(10);
      
          // I won't use lookup anymore
          delete lookup;
      
          // Let's close the app
          QCoreApplication::quit();
      }
      

       

      The output of Xcode mem leak result is attached.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            comandillos Alejandro Antunez Reino
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes