It seems like after I create a QNetworkAccessManager object in Qt, it makes other applications (those who heavily uses network, such as multiplayer game) run slow.
For example, if I run Dota2 while running my app as a background, the game starts to lag even if my Qt app is very light (I checked through process explorer and it only consumes under 1% of CPU usage whole time). If I remove the QNetworkAccessManager part from the code, then game runs smoothly without any lagging.
Here is how I use QNetworkAccessManager;
QNetworkAccessManager *qnam = new QNetworkAccessManager(this);
response = qnam->get(QNetworkRequest(url));
connect(response , &QNetworkReply::finished, this, &Test::parse_response);
And in parse_response()
void parse_response() {
// Network Error occured
if (response->error() != QNetworkReply::NoError) {
response->deleteLater();
return;
}
response->deleteLater();
qnam->deleteLater();
}
Funny thing is that when I check I/O usage of my app through process explorer, it shows weird activity on I/O usage
When I haven't used QNetworkAccessManager, that weird I/O Usage disappears. Hence I assume that my qnam has not been successfully deleted yet could not found any problem in my code.
If has anyone had similar experiences with this problem? Or is it just my configuration of usage of QNetworkAccessManager incorrect?
I found out that it was a bug within QNetworkAccessManager.
In Wireless environment, QNetworkAccessManager scans the wifi status every few seconds. Those little spikes were the evidence for that. Check the following bug report.
https://bugreports.qt.io/browse/QTBUG-40332
To solve this problem, either compile with
-D QT_NO_BEARERMANAGEMENT
option or just remove bearer folder in a plugin.