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

[BUG] Consuming CPU continuously with the number of active GADNativeAd instances #464

Open
s2mr opened this issue Sep 16, 2024 · 0 comments

Comments

@s2mr
Copy link

s2mr commented Sep 16, 2024

Hello.
I am loading multiple native ads using GADAdLoader.
The loaded GADNativeAds are retained in an array as properties within my class.

Even when the ads are not displayed on the screen, just retaining the instances is causing CPU usage.
Typically, with five instances, the main thread continues to use about 20%.
Since I am loading and retaining 15 ads in my app, about 60% is constantly in use.
I have confirmed this by debugging on a real device.

Also, when I checked with Instruments, it seems that the AVAudioSession.currentRoute is being checked at a frequency of about every 0.2 seconds, and this appears to be the cause.
Is GADNativeAd the one checking this?
Is it possible to turn this off or make a fix?

I believe this has been occurring since quite an earlier version.
I have confirmed that it occurs even in version 11.5.0 of the Google-Mobile-Ads-SDK as well as in the latest version 11.9.0.
I am installing it via CocoaPods.

Additionally, I checked the example repository just in case, and the same phenomenon occurs.
In this code, since it retains only one instance, the impact is minimal, but when modified to load and retain multiple instances, it occurs.

// let options = GADMultipleAdsAdLoaderOptions()
// options.numberOfAds = 5

https://github.com/googleads/googleads-mobile-ios-examples/tree/main/Swift/advanced/SwiftUIDemo/SwiftUIDemo/Native

I would appreciate it if you could look into this when you have time.

@s2mr s2mr changed the title Consuming CPU continuously with the number of active GADNativeAd instances [BUG] Consuming CPU continuously with the number of active GADNativeAd instances Sep 16, 2024
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

No branches or pull requests

1 participant