Instabug-Android icon indicating copy to clipboard operation
Instabug-Android copied to clipboard

Leak on OnboardingActivity

Open damianpetla opened this issue 8 months ago • 1 comments

Steps to Reproduce the Problem

Start the app with enabled Instabug and wait for welcome message.

I have discovered this with LeakCanary. As soon as welcome message disappear leak canary reports leak

Expected Behavior

No memory leaks

Actual Behavior

┬───
│ GC Root: Global variable in native code
│
├─ <package>.AndroidApplication instance
│    Leaking: NO (Application is a singleton)
│    mBase instance of android.app.ContextImpl
│    ↓ Application.mActivityLifecycleCallbacks
│                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
├─ java.util.ArrayList instance
│    Leaking: UNKNOWN
│    Retaining 111.9 kB in 2058 objects
│    ↓ ArrayList[22]
│               ~~~~
├─ io.getstream.chat.android.common.notifications.permissions.
│  SnackbarNotificationPermissionHandler instance
│    Leaking: UNKNOWN
│    Retaining 77 B in 3 objects
│    context instance of <package>.AndroidApplication
│    currentActivity instance of com.instabug.bug.onboardingbugreporting.
│    OnboardingActivity with mDestroyed = true
│    ↓ SnackbarNotificationPermissionHandler.currentActivity
│                                            ~~~~~~~~~~~~~~~
╰→ com.instabug.bug.onboardingbugreporting.OnboardingActivity instance
​     Leaking: YES (ObjectWatcher was watching this because com.instabug.bug.
​     onboardingbugreporting.OnboardingActivity received Activity#onDestroy()
​     callback and Activity#mDestroyed is true)
​     Retaining 111.2 kB in 2030 objects
​     key = 64149df4-d98e-4b20-a66f-2b35b202b7cb
​     watchDurationMillis = 5647
​     retainedDurationMillis = 645
​     mApplication instance of <package>.AndroidApplication
​     mBase instance of androidx.appcompat.view.ContextThemeWrapper

Instabug integration code

Make sure to remove your app token.

Instabug.Builder(application, token, InstabugInvocationEvent.SHAKE).build()
Instabug.setColorTheme(InstabugColorTheme.InstabugColorThemeDark)
Instabug.setPrimaryColor(ExtendedColors.tiltPaletteSky5.toArgb())
CrashReporting.setState(Feature.State.DISABLED)
CrashReporting.setAnrState(Feature.State.DISABLED)
APM.setEnabled(false)
Surveys.setState(Feature.State.ENABLED)
Instabug.setWelcomeMessageState(WelcomeMessage.State.LIVE)

SDK Version

13.0.1

Android Version

12

Device Model

Pixel 3 XL

[Optional] Project That Reproduces the Issue

damianpetla avatar Jun 27 '24 10:06 damianpetla