New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak #72
Comments
when do you pop your view controller? |
When I clicked the system launch button pop ShowOverlayExampleViewController in the upper left corner, I found that ShowOverlayExampleViewController did not execute deinit. |
My simple guess is that overlayPresentationController may cause memory leaks |
Interesting. The leak exists as soon as you call class TestViewController: UIViewController {
// MARK: - Life Cycle
init() {
super.init(nibName: nil, bundle: nil)
view.backgroundColor = .systemRed
}
@available(*, unavailable)
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
let controller = PushedViewController()
let presentationController = controller.presentationController
navigationController?.pushViewController(controller, animated: true)
}
}
class PushedViewController: UIViewController {
// MARK: - Life Cycle
init() {
super.init(nibName: nil, bundle: nil)
view.backgroundColor = .systemBlue
}
deinit {
print("Deinit") // never called
}
@available(*, unavailable)
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
} |
Here is a fix. I don't like it but I will release it if I do not find something better. Thanks for pointing me the issue! It is critical. |
Describe the bug
A clear and concise description of what the bug is.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots, videos or sample codes
If applicable, add screenshots to help explain your problem.
Environnement :
Additional context
Add any other context about the problem here.
ShowOverlayExampleViewController popViewController deinit does not execute
The text was updated successfully, but these errors were encountered: