QNetworkAccesManager memory leak

101 views Asked by At

Why this code, running repeatedly in a custom object moved to QThread instance, produces memory leak?

void QCustomHTTPManager::compare()
{
    // custom code to create request and  multiPart content
    QNetworkReply *reply = networkaccessmanager->post(request,&multiPart);
    connect(reply,&QNetworkReply::finished,eventloop,&QEventLoop::quit);
    eventloop->exec();
    emit compared();
    reply->deleteLater();
}

memory leak is around 8 bytes per call

Platform: Ubuntu 20.04, x86_64 CPU, Qt 5.14.2

To check maybe some other parts of my program belongs to the leak i have remove post() and no memory leak has been detected:

void QCustomHTTPManager::compare()
{
     // custom code to create request and  multiPart content
    QTimer::singleShot(1,loop,&QEventLoop::quit);
    eventloop->exec();
    emit compared();
}
1

There are 1 answers

0
Alex On

It was an issue of Qt build 5.14.2. No memory leaks for the requested code above have been reproduced with Qt 5.9.7 and 6.4.1