NSURLSession HTTP/2 memory leak

前端 未结 1 1632
感情败类
感情败类 2021-02-20 11:39

This My Test cases, point out that when using NSURLSession with a HTTP/2 connection there is memory problem.

test1: iOS 9. HTTP/2 server

I use

1条回答
  •  花落未央
    2021-02-20 12:21

    From apple doc:

    The session object keeps a strong reference to the delegate until your app exits or explicitly invalidates the session. If you don’t invalidate the session, your app leaks memory until it exits.

    Also looking at your project https://github.com/upyun/swift-sdk/tree/testleak you need to call finishTasksAndInvalidate() after sessionTask.resume() since you are creating session per request

    0 讨论(0)
提交回复
热议问题