SCNView doesn't free added gesture recognizers after deinit
Originator: | nazarof.anton | ||
Number: | rdar://6164844138987523 | Date Originated: | 9 July, 2019 |
Status: | Resolved: | ||
Product: | SceneKit | Product Version: | 12.0 |
Classification: | Bug | Reproducible: | Yes |
CNView doesn't free added gesture recognizers after deinit. Please check out provided test case. var wasDeallocated = false class MyGestureRecognizer: UIGestureRecognizer { deinit { wasDeallocated = true } } class Foo { let scnView = SCNView() // test passes if change to `UIView()` init() { scnView.addGestureRecognizer(MyGestureRecognizer(target: self, action: #selector(test))) } @objc func test() { } } final class Test: XCTestCase { func testMemoryLeak() { autoreleasepool { _ = Foo() } XCTAssertTrue(wasDeallocated) } }
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
TLDR: This is a bug, but there is not a recognizer leak, but a whole scene leak. Workaround: create another one SCNView instance.