MobileAds.registerWebView() causing memory leak

365 views
Skip to first unread message

Aayush Jain

unread,
Mar 26, 2024, 12:14:05 PM3/26/24
to Google Mobile Ads SDK Developers
We are seeing a critical memory leak related to GMA WebView api (https://developers.google.com/admob/android/browser/webview/api-for-ads) in our production app.

To reproduce this leak we are sharing a test app similar to our production app along with steps and video to reproduce

GMA SDK Version: com.google.android.gms:play-services-ads:23.0.0

Steps to reproduce (refer video):
1. Open test app
2. Quickly swipe back and forth between fragments
3. In between go back and again launch test app
4. Repeat steps 2 and 3 for some time and you should be able to see LeakCanary detection dialog

Following is the memory leak trace:

┬───
│ GC Root: Thread object

├─ WV.ed instance
│    Leaking: NO (PathClassLoader↓ is not leaking)
│    Thread name: 'CleanupReference'
│    ↓ Thread.contextClassLoader
├─ dalvik.system.PathClassLoader instance
│    Leaking: NO (zzbxk↓ is not leaking and A ClassLoader is never leaking)
│    ↓ ClassLoader.runtimeInternalObjects
├─ java.lang.Object[] array
│    Leaking: NO (zzbxk↓ is not leaking)
│    ↓ Object[193]
├─ com.google.android.gms.internal.ads.zzbxk class
│    Leaking: NO (a class is never leaking)
│    ↓ static zzbxk.zza
│                   ~~~
├─ com.google.android.gms.internal.ads.zzccr instance
│    Leaking: UNKNOWN
│    Retaining 16 B in 1 objects
│    ↓ zzayg.zza
│            ~~~
├─ com.google.android.gms.ads.nonagon.signalgeneration.z instance
│    Leaking: UNKNOWN
│    Retaining 171.6 kB in 3024 objects
│    e instance of com.gma.webviewtest.MainActivity with mDestroyed =
│    true
│    ↓ z.e
│        ~
╰→ com.gma.webviewtest.MainActivity instance
​     Leaking: YES (ObjectWatcher was watching this because com.gma.
​     webviewtest.MainActivity received Activity#onDestroy() callback and
​     Activity#mDestroyed is true)
​     Retaining 170.3 kB in 3000 objects
​     key = 772c5794-d3f1-4a1e-b574-efb34af09493
​     watchDurationMillis = 5789
​     retainedDurationMillis = 754
​     mApplication instance of android.app.Application
​     mBase instance of androidx.appcompat.view.ContextThemeWrapper

METADATA

Build.VERSION.SDK_INT: 31
Build.MANUFACTURER: Xiaomi
LeakCanary version: 3.0-alpha-1
App process name: com.gma.webviewtest
Class count: 26687
Instance count: 247080
Primitive array count: 149432
Object array count: 33101
Thread count: 80
Heap total bytes: 29816310
Bitmap count: 82
Bitmap total bytes: 4256526
Large bitmap count: 0
Large bitmap total bytes: 0
Db 1: open /data/user/0/com.gma.webviewtest/no_backup/androidx.work.
workdb
Stats: LruCache[maxSize=3000,hits=123887,misses=221172,hitRate=35%]
RandomAccess[bytes=10988277,reads=221172,travel=84039994842,range=36239076,size=
44175871]
Analysis duration: 38439 ms


Note: This was reported in our production app performance testing where the memory leaked was as high as 500 MB


Please let us know if anything else is needed. 

Mobile Ads SDK Forum Advisor

unread,
Mar 27, 2024, 2:08:18 AM3/27/24
to google-adm...@googlegroups.com
Hi,

I will check with our team regarding your issue and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02s0FSb:ref" (ADR-00228768)

Thanks,
 
Google Logo Mobile Ads SDK Team


Aayush Jain

unread,
Apr 1, 2024, 2:03:30 AM4/1/24
to Google Mobile Ads SDK Developers
Hi team,
Do you have an update on this? Are you able to reproduce it at your end?

Aayush Jain

unread,
Apr 1, 2024, 4:50:52 AM4/1/24
to Google Mobile Ads SDK Developers
Hi Team,
Do you have an update on this issue? Are you able to reproduce it?

On Wednesday, March 27, 2024 at 11:38:18 AM UTC+5:30 Mobile Ads SDK Forum Advisor wrote:

Mobile Ads SDK Forum Advisor

unread,
Apr 1, 2024, 8:57:08 AM4/1/24
to google-adm...@googlegroups.com
Hi,

Yes we have reproduced the issue, and as mentioned our team is currently looking into the issue. we'll get back to you once we have further update.
Thank you for your patience.

Aayush Jain

unread,
Apr 1, 2024, 9:07:51 AM4/1/24
to Google Mobile Ads SDK Developers
Hi,
Thanks for the quick response. Any idea when we might see an update on this? It's pretty important for our next product release/

Aayush Jain

unread,
Apr 5, 2024, 7:26:18 AM4/5/24
to Google Mobile Ads SDK Developers
Hi Team,
Do you have any update on this issue?

Aayush Jain

unread,
Apr 15, 2024, 6:40:20 AM4/15/24
to Google Mobile Ads SDK Developers
Any update on this issue? 

Reply all
Reply to author
Forward
0 new messages