Alamofire: Memory retained and never released. urlSession::didFinishCollecting never called on watchOS

What did you do?

I am making 100s of network requests. My test is ~600 requests in a loop. I see the memory usage continue to go up and not return. I see in Xcode’s Memory Graph that there are 1000s of DataRequest objects still allocated, and this number goes up with each run of the test.

I see that there is an object holding all the DataRequest objects: Dictionary<Request, NSURLSessionTask> and that object holds all the requests.

What did you expect to happen?

Memory to not increase while making network requests. Mainly, the memory usage to return after all the requests are completed.

What happened instead?

Memory grows as network requests are made. The graph is steady during use.

I only see the issue on watchOS.

Alamofire Environment

Alamofire version: github “Alamofire/Alamofire” “5.0.2” github “Alamofire/AlamofireImage” “4.0.3” Xcode version: Reproduced on 11.1 and 11.3.1 Swift version: Xcode 11.1: Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7) Platform(s) running Alamofire: iOS and watchOS macOS version running Xcode: 10.15.3

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (14 by maintainers)

Most upvoted comments

5.0.3 has been released!