while(1){
QNetworkAccessManager *aa = new QNetworkAccessManager();
QNetworkReply *bb;
QNetworkRequest Request;
Request.
setUrl(QUrl("http://127.0.0.1"));
bb= aa->get(Request);
bb->abort();
bb->close();
bb->deleteLater();
bb = NULL;
delete aa;
aa = NULL;
}
while(1){
QNetworkAccessManager *aa = new QNetworkAccessManager();
QNetworkReply *bb;
QNetworkRequest Request;
Request.setUrl(QUrl("http://127.0.0.1"));
bb= aa->get(Request);
bb->abort();
bb->close();
bb->deleteLater();
bb = NULL;
delete aa;
aa = NULL;
}
To copy to clipboard, switch view to plain text mode
i have a web spider project using QNetworkAccessManager,this code is a example,run this code
you can see the memory no leak,but most people no carefully review the other information in the code's progress
use progress view or windows7 task manager ,you can see the handle-count,up up up
after a while,the progress memory Perhaps still between 30M - 60M
but the handle count has not been reduced.
if the handle count > 1,000,000,the program died
what's the problem,i try to watch QNetworkAccessManager class's code,but no help
it's QNetworkAccessManager class's bug,not my,right?
if it's my problem,how can i fix it,and where
os:win7 + qt4.8.1
Bookmarks