Solved How to use QNetworkAccessManager without leaking memory.
-
You never reset qnamUses. Therefore after 51 requests, you recreate your qnam object for every request.
-
Reset was fixed in test.
Is there a way to use single instance of QNetworkAccessManager for 10k+ times without drastic memory usage growth? -
@Q139 said in How to use QNetworkAccessManager without leaking memory.:
I still get leak.
The Task manager is no tool to measure a memory leak!
Is there a way to use single instance of QNetworkAccessManager for 10k+ times without drastic memory usage growth?
Yes, simply use it.
-
@Christian-Ehrlicher It ends with app filling memory and crashing if simply using.
-
@Q139 I still don't have a valid reproducer for this behavior...
-
@Christian-Ehrlicher I tryed and it leaks on win 7 in vmware and win 10 native.
What version of Qt are you running? Did you also intall the openSSL?This produces problem in my tests. Only solution i find is to delete QNetworkAccessManager after some period and recreate it.
@Q139 said in How to use QNetworkAccessManager without leaking memory.:Install openSSL on Windows 7 or 10 and see if the app below leaks memory.
Windows ssl libraries site
direct link to download-Win64 OpenSSL v1.1.1g Light -
@Q139 said in How to use QNetworkAccessManager without leaking memory.:
Did you also intall the openSSL?
No need for ssl at all since your url ist http.
-
´Please update the wait time between two requests to 100ms and see if the problem still persists. Looks like there is a race condition when the same url is queried very fast. But can't see the main reason for it currently.
-
Using 100ms and variable urls solves it.
-
Helpful discussion for me ,thank eveyone
Same situation with Qt 5.14.2 Mingw on Windows7 and Qt5.9.9 on MacOSX -
@Christian-Ehrlicher said in How to use QNetworkAccessManager without leaking memory.:
´Please update the wait time between two requests to 100ms and see if the problem still persists. Looks like there is a race condition when the same url is queried very fast. But can't see the main reason for it currently.
Hi, we meet this bug on site. is this bug fixed in the newer versions?