-
Notifications
You must be signed in to change notification settings - Fork 87
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
Fix Dispatcher leak #849
Fix Dispatcher leak #849
Conversation
@@ -74,6 +74,10 @@ public class AdUnit: NSObject, DispatcherDelegate { | |||
// PBS should cache the bid for original api. | |||
Prebid.shared.useCacheForReportingWithRenderingAPI = true | |||
} | |||
|
|||
deinit { | |||
dispatcher?.invalidate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we invalidate / stop dispatcher in the deinit
of Dispatcher
itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we can't cause Timer
holds a strong reference to Dispatcher
, which means deinit
is never called until Timer
gets invalidated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks for the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -74,6 +74,10 @@ public class AdUnit: NSObject, DispatcherDelegate { | |||
// PBS should cache the bid for original api. | |||
Prebid.shared.useCacheForReportingWithRenderingAPI = true | |||
} | |||
|
|||
deinit { | |||
dispatcher?.invalidate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks for the explanation.
#840