You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found a memory leak in the sandbox environment (I haven't been able to test production build due to company policies), when using PayPal Native Checkout for Android, Leak Canary identifies the leak related to the com.paypal.pyplcheckout.ui.feature.home.viewmodel.MainPaysheetViewModel, after repeatedly opening and closing the PayPal sheet, it appears that the authListener and doAfterAuth are not being properly released, leading to memory retention.
┬───
│ GC Root: Thread object
│
├─ WV.Yc instance
│ Leaking: NO (PathClassLoader↓ is not leaking)
│ Thread name: 'CleanupReference'
│ ↓ Thread.contextClassLoader
├─ dalvik.system.PathClassLoader instance
│ Leaking: NO (LocalBroadcastManager↓ is not leaking and A ClassLoader is
│ never leaking)
│ ↓ ClassLoader.runtimeInternalObjects
├─ java.lang.Object[] array
│ Leaking: NO (LocalBroadcastManager↓ is not leaking)
│ ↓ Object[3987]
├─ androidx.localbroadcastmanager.content.LocalBroadcastManager class
│ Leaking: NO (a class is never leaking)
│ ↓ static LocalBroadcastManager.mInstance
│ ~~~~~~~~~
├─ androidx.localbroadcastmanager.content.LocalBroadcastManager instance
│ Leaking: UNKNOWN
│ Retaining 1.8 kB in 63 objects
│ mAppContext instance of com.**package**..
│ ↓ LocalBroadcastManager.mReceivers
│ ~~~~~~~~~~
├─ java.util.HashMap instance
│ Leaking: UNKNOWN
│ Retaining 296 B in 14 objects
│ ↓ HashMap[key()]
│ ~~~~~~~
├─ com.paypal.authcore.authentication.Authenticator$a instance
│ Leaking: UNKNOWN
│ Retaining 20 B in 1 objects
│ ↓ Authenticator$a.a
│ ~
├─ com.paypal.authcore.authentication.Authenticator instance
│ Leaking: UNKNOWN
│ Retaining 13.5 kB in 357 objects
│ j instance of **package**
│ ↓ Authenticator.g
│ ~
├─ com.paypal.pyplcheckout.flavorauth.
│ WebBasedAuthAccessTokenUseCase$invoke$authDelegate$1 instance
│ Leaking: UNKNOWN
│ Retaining 7.9 kB in 291 objects
│ Anonymous class implementing com.paypal.authcore.authentication.
│ AuthenticationDelegate
│ ↓ WebBasedAuthAccessTokenUseCase$invoke$authDelegate$1.$authListener
│ ~~~~~~~~~~~~~
├─ com.paypal.pyplcheckout.data.repositories.auth.AuthHandler instance
│ Leaking: UNKNOWN
│ Retaining 7.9 kB in 290 objects
│ ↓ AuthHandler.doAfterAuth
│ ~~~~~~~~~~~
├─ com.paypal.pyplcheckout.ui.feature.home.viewmodel.
│ MainPaysheetViewModel$$ExternalSyntheticLambda19 instance
│ Leaking: UNKNOWN
│ Retaining 7.7 kB in 280 objects
│ ↓ MainPaysheetViewModel$$ExternalSyntheticLambda19.f$0
│ ~~~
╰→ com.paypal.pyplcheckout.ui.feature.home.viewmodel.MainPaysheetViewModel
instance
Leaking: YES (ObjectWatcher was watching this because com.paypal.
pyplcheckout.ui.feature.home.viewmodel.MainPaysheetViewModel received
ViewModel#onCleared() callback)
Retaining 7.7 kB in 279 objects
key = f663730b-63f4-4e57-9cfe-30493c07613e
watchDurationMillis = 14555
retainedDurationMillis = 9542
METADATA
Build.VERSION.SDK_INT: 34
Build.MANUFACTURER: Google
LeakCanary version: 2.14
Braintree SDK Version
4.45.0
Environment
Sandbox
Android Version & Device
Android 14 - Pixel 5
Braintree dependencies
Describe the bug
I've found a memory leak in the sandbox environment (I haven't been able to test production build due to company policies), when using PayPal Native Checkout for Android, Leak Canary identifies the leak related to the
com.paypal.pyplcheckout.ui.feature.home.viewmodel.MainPaysheetViewModel
, after repeatedly opening and closing the PayPal sheet, it appears that theauthListener
anddoAfterAuth
are not being properly released, leading to memory retention.The issue is also replicable in the sample app Demo.
demo_sample_app.m4v.zip
To reproduce
Expected behavior
After closing the PayPal Native Checkout sheet, all resources should be released properly.
Screenshots
The text was updated successfully, but these errors were encountered: