Google Mobile Ads SDK : RewardedAd.load() causing multiple leaks

469 views
Skip to first unread message

vishal chougule

unread,
Feb 23, 2024, 8:15:24 AM2/23/24
to Google Mobile Ads SDK Developers
Hi Team,
I was trying RewardedAd into one of my applications and while doing that I found multiple leaks. I have attached reference leaks.

Few of things I would like to mention 
1. I have used the application context and i am avoiding pass activity references while using `RewardedAd.load()` API, but still i am getting the activity leaks.  
2. This is mostly happening on multi-activity applications, where one activity is used to load Rewarded Ads and as soon as I return from that activity leaks can be seen.
3. I see similar issues were reported earlier and the answer was that it was a temporary leak, but then I did the memory profiling, it seemed like a considerable amount of memory was consumed and the graph kept increasing every time the leak happened.

I have attached a sample app, that will help you reproduce the issue. Please help me resolve the leaks. 
 
Please let me know if you have any queries. I would be happy to help you.

Thanks,
Vishal




RewardedVideoExample.zip
leak2.txt
leak1.txt

Mobile Ads SDK Forum Advisor

unread,
Feb 23, 2024, 1:56:52 PM2/23/24
to chougul...@gmail.com, google-adm...@googlegroups.com
Hi,

Thank you for contacting the Mobile Ads SDK support team.

We were not able to replicate the issue on our end. If you could provide a detailed steps on how to replicate this I can take another look.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02rzOm2:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Mobile Ads SDK Forum Advisor

unread,
Feb 26, 2024, 8:38:36 AM2/26/24
to chougul...@gmail.com, google-adm...@googlegroups.com
Hi Vishal,

Thank you for demonstrating the issue reproduction.

I'm able to reproduce the issue in the sample project provided by you, I have checked your sample and have run Memory profiler which indicates that the retained memory is not related to the Ads SDK. Where the objects that gets retained are Button views that are set in activities. Hence leaks in the application may not be caused due to the Google Mobile Ads SDK. 
If you have any concerns regarding Google Mobile Ads SDK kindly contact us.

vishal chougule

unread,
Feb 26, 2024, 10:02:43 AM2/26/24
to Google Mobile Ads SDK Developers
Hi, 

To reproduce the issue, please follow the below steps
1. Click the 'Load Rewarded Ad' button 
2. Load the rewarded ad using the 'Load Ad' button, and wait for a minute for GAM SDK to load the ads
3. Show the rewarded ad.
4. skip the rewarded ad after a few seconds.
5. Move back to the previous activity by clicking on the hardware back button.
6. Repeat the same activity multiple times.
7. You will be able to see a leak notification.
Please refer to the below video link that demonstrates the reproduction of leaks on GAM rewarded ad API, I hope this will help you reproduce the leaks.

Thanks,
Vishal

vishal chougule

unread,
Feb 26, 2024, 10:03:23 AM2/26/24
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Hi,
Please follow the below video link, which demonstrates the leak reproduction on the same application, I hope this will help reproduce the leaks.

Thanks,
Vishal

Mobile Ads SDK Forum Advisor

unread,
Feb 26, 2024, 10:40:45 AM2/26/24
to chougul...@gmail.com, google-adm...@googlegroups.com
Hi Vishal, 

I'm able to reproduce the issue as mentioned in the previous reply, And the memory leaks are not related to Mobile Ads SDK. After reviewing through Memory profiler I have seen That those memory leaks are due to retained button views. kindly try to run Memory Profiler in android studio and view the references of the leaks. If you still think issue is caused by Google Mobile Ads SDK please provide the logs containing the same, we will look into the issue.

vishal chougule

unread,
Feb 27, 2024, 5:05:30 AM2/27/24
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Hi,

I have done the Android Studio memory profiling on the same application with the earlier-mentioned steps. I can see the memory leaks on the Android Studio memory profiler window. I have recorded the session, please refer to this link: https://drive.google.com/file/d/1AKxWoQxKwCyza5-HyOPgWpUpArMQ6yy7/view?usp=drive_link  
Also please refer to .hprof file of the same session, download this at your end to analyze the memory profiling by importing it to your Android Studio Profiler.

Note: Though I am passing application context to the load API, the leak is always happening on the activity reference. I have also seen these leaks without showing the rewarded ads(Only using load() API and not showing the ads)

I hope this will help you to understand the leaks.  

Thanks,
Vishal

Mobile Ads SDK Forum Advisor

unread,
Feb 27, 2024, 11:12:57 AM2/27/24
to chougul...@gmail.com, google-adm...@googlegroups.com
Hi Vishal,

Thank you for providing more details.

Thanks for sending the video which illustrated the memory leak issue clearly. Since you have stated that you are passing application context to the load API, the leak is always happening on the activity reference. You would be able to solve the issue by passing the applicationContext to the AdView, instead of the activity/fragment context.

I hope this helps! Let me know if you have any other questions. 

vishal chougule

unread,
Feb 28, 2024, 2:29:29 AM2/28/24
to Google Mobile Ads SDK Developers
Hi Team,

I am not sure what you want to say when you use the word AdView, FYI This leak has been observed for Rewarded Ad where I am passing application context to RewardedAd.Load() API as mentioned in GAM SDK API reference. and while presenting/showing the Rewarded Ad it is mandatory to pass activity reference and you can refer to method API reference.
As I mentioned in my earlier thread, I can see activity-specific leaks even when I use application context when loading Rewarded Ad, and without calling   RewardedAd.show() API I am returning to the previous activity. 

Again you can refer to the earlier comments for reproduction of leaks and stack trace from the .hprof file. You will find that activity leaks are happening through GAM SDK's internal APIs.

I hope this will help you understand leaks.

Thanks,
Vishal 

Mobile Ads SDK Forum Advisor

unread,
Feb 28, 2024, 5:45:41 AM2/28/24
to chougul...@gmail.com, google-adm...@googlegroups.com
Hi, 

Thank you for contacting the Mobile Ads SDK support team.

By reviewing your concern, I understand that you are facing a memory leak in Reward Ads. From the source code provided we are able to replicate the issue and I would like to inform you that our team is currently working on this issue. One of our teammates will get back to you once we have an update on this.Meanwhile your patience is appreciated.

vishal chougule

unread,
Mar 5, 2024, 8:19:27 PM3/5/24
to Google Mobile Ads SDK Developers
Hi,
Any updates?

Thanks,
Vishal

Mobile Ads SDK Forum Advisor

unread,
Mar 5, 2024, 8:42:33 PM3/5/24
to chougul...@gmail.com, google-adm...@googlegroups.com
Hi Vishal,

Your concern is still under investigation and we have no updates at the moment. However, allow me to follow up on this with the rest of the team. Thank you for your patience.

vishal chougule

unread,
Mar 12, 2024, 6:50:46 AM3/12/24
to Google Mobile Ads SDK Developers
Hi,

Did you or your team get a chance to look into the leaks? Any idea on the root cause of the leaks?   

Thanks,
Vishal

Mobile Ads SDK Forum Advisor

unread,
Mar 12, 2024, 9:22:33 AM3/12/24
to chougul...@gmail.com, google-adm...@googlegroups.com

Hi Vishal,

Thank you for getting back to us.

Your inquiry is currently undergoing investigation, and we do not have any updates to provide at this time. However, please be assured that our team is actively working on the matter. We appreciate your understanding and patience.

This message is in relation to case "ref:!00D1U01174p.!5004Q02rzOm2:ref" (ADR-00224584)


Thanks,
 
Google Logo Mobile Ads SDK Team

 

vishal chougule

unread,
Mar 20, 2024, 11:58:11 PM3/20/24
to Google Mobile Ads SDK Developers
Hi, 
Did you hear any progress updates from your team on this leak?

Thanks,
Vishal

vishal chougule

unread,
Apr 11, 2024, 10:08:48 AM4/11/24
to Google Mobile Ads SDK Developers
Hi,
I have not heard back since last month, Can you please help me understand when the issue will be fixed?

Thanks,
Vishal 

vishal chougule

unread,
Apr 11, 2024, 10:08:57 AM4/11/24
to Google Mobile Ads SDK Developers
Hi,
I have not heard back since last month, Can you please help me understand when the issue will be fixed?

Thanks,
Vishal 

On Thursday 21 March 2024 at 09:28:11 UTC+5:30 vishal chougule wrote:

Mobile Ads SDK Forum Advisor

unread,
Apr 12, 2024, 3:51:41 AM4/12/24
to chougul...@gmail.com, google-adm...@googlegroups.com

Hi Vishal,

We do not have a specific time frame for the availability of this feature at the moment. Please be assured that our team is actively working on it and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated.

vishal chougule

unread,
Oct 17, 2024, 4:10:57 AM10/17/24
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Any update on this? 

Mobile Ads SDK Forum Advisor

unread,
Oct 21, 2024, 10:13:23 AM10/21/24
to chougul...@gmail.com, google-adm...@googlegroups.com
Hello,

Thank you for your inquiry. The engineering team is still working on this issue. I will respond here as soon as I have an update to share. 
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02rzOm2:ref" (ADR-00224584)

Thanks,
 
Google Logo
Justin Malandruccolo
Mobile Ads SDK Team


Reply all
Reply to author
Forward
0 new messages