Cocos2d-x-Asynchronous-Http-Request-Library
Cocos2d-x-Asynchronous-Http-Request-Library copied to clipboard
why not use purgeSharedHttpRequest() to prevent memory leak?
Why not call requestor->purgeSharedHttpRequest() after requestor->addDownloadTask(downloads, this, callfuncND_selector(HelloWorld::onHttpRequestCompleted));
to release the requestor object?
I added it after addDownloadTask in demo, but still find memory leak because scheduleSelector will retain request object again, but not release it, so if I use purgeSharedHttpRequest at final, the memory leak still exist.
//Add a download task to queue void CCHttpRequest::addDownloadTask(std::vectorstd::string &urls, CCObject *pTarget, SEL_CallFuncND pSelector) { bool init = lazyInitThreadSemphore(); if (!init) { return; }
if (0 == s_asyncRequestCount) {
CCDirector::sharedDirector()->getScheduler()->scheduleSelector(schedule_selector(CCHttpRequest::httpRequestCallback), this, 0, false);
}
....
}