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
MonetCompat is a singleton that stores its own instance in the INSTANCE field. The problem is that MonetCompatActivity creates it by passing itself as context. As a result, when the activity is destroyed, it remains bound to MonetCompat and cannot be released by the garbage collector.
The MonetCompat registers the BroadcastReceiver in the setup method if running on Android 12 or older versions of Android. The MonetCompatActivity calls setup on creation by passing itself to it as context. However, when the activity is destroyed, this BroadcastReceiver is not unregistered, which leads to activity leakage.
For me, the only way to avoid these leaks is to stop using MonetCompatActivity and initialize MonetCompat myself using the application context.
The text was updated successfully, but these errors were encountered:
zobnin
changed the title
MonetCompatActivity memory leak
MonetCompatActivity memory leaks
Aug 20, 2022
MonetCompat
is a singleton that stores its own instance in theINSTANCE
field. The problem is thatMonetCompatActivity
creates it by passing itself as context. As a result, when the activity is destroyed, it remains bound toMonetCompat
and cannot be released by the garbage collector.The
MonetCompat
registers theBroadcastReceiver
in thesetup
method if running on Android 12 or older versions of Android. TheMonetCompatActivity
callssetup
on creation by passing itself to it as context. However, when the activity is destroyed, thisBroadcastReceiver
is not unregistered, which leads to activity leakage.For me, the only way to avoid these leaks is to stop using
MonetCompatActivity
and initializeMonetCompat
myself using the application context.The text was updated successfully, but these errors were encountered: