Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leak on OnboardingActivity #483

Open
damianpetla opened this issue Jun 27, 2024 · 1 comment
Open

Leak on OnboardingActivity #483

damianpetla opened this issue Jun 27, 2024 · 1 comment

Comments

@damianpetla
Copy link

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
Copy link
Author

Look like same thing happens when closing Bug report dialog

┬───
│ 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 80.4 kB in 1429 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.invocation.invocationdialog.
│    InstabugDialogActivity with mDestroyed = true
│    ↓ SnackbarNotificationPermissionHandler.currentActivity
│                                            ~~~~~~~~~~~~~~~
╰→ com.instabug.bug.invocation.invocationdialog.InstabugDialogActivity instance
​     Leaking: YES (ObjectWatcher was watching this because com.instabug.bug.
​     invocation.invocationdialog.InstabugDialogActivity received
​     Activity#onDestroy() callback and Activity#mDestroyed is true)
​     Retaining 79.7 kB in 1401 objects
​     key = a0ceee20-fa84-4436-b28c-1ea9e1aa95cf
​     watchDurationMillis = 5650
​     retainedDurationMillis = 644
​     mApplication instance of <package>.AndroidApplication
​     mBase instance of androidx.appcompat.view.ContextThemeWrapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant