Skip to content
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

Merged
merged 1 commit into from
May 19, 2023
Merged

Fix Dispatcher leak #849

merged 1 commit into from
May 19, 2023

Conversation

OlenaPostindustria
Copy link
Collaborator

@@ -74,6 +74,10 @@ public class AdUnit: NSObject, DispatcherDelegate {
// PBS should cache the bid for original api.
Prebid.shared.useCacheForReportingWithRenderingAPI = true
}

deinit {
dispatcher?.invalidate()
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

Copy link
Contributor

@YuriyVelichkoPI YuriyVelichkoPI left a 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()
Copy link
Contributor

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.

@YuriyVelichkoPI YuriyVelichkoPI merged commit be3bab2 into master May 19, 2023
@YuriyVelichkoPI YuriyVelichkoPI deleted the fix-memory-leak branch May 19, 2023 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants