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

InputMethodManager.mLastSrvView memory leak in Android6.0 with huawei mobile phone #572

Closed
ljian opened this issue Jul 27, 2016 · 7 comments

Comments

@ljian
Copy link

ljian commented Jul 27, 2016

com.xxx.activity.XXXActivity has leaked:

  • GC ROOT static android.view.inputmethod.InputMethodManager.sInstance
  • references android.view.inputmethod.InputMethodManager.mLastSrvView
  • references com.xx.TextView.mContext
  • leaks com.xxx.activity.XXXActivity instance

i just fond this with mCurRootView excludedRefs
INPUT_METHOD_MANAGER__ROOT_VIEW = new AndroidExcludedRefs("INPUT_METHOD_MANAGER__ROOT_VIEW", 6, VERSION.SDK_INT >= 15 && VERSION.SDK_INT <= 23, null) {
void add(Builder excluded) {
excluded.instanceField("android.view.inputmethod.InputMethodManager", "mCurRootView").reason("The singleton InputMethodManager is holding a reference to mCurRootView long after the activity has been destroyed. Observed on ICS MR1: #1 (comment) Hack: https://gist.github.com/pyricau/4df64341cc978a7de414");
}
};

so do you consider to add this into excludedrefs?

@ljian ljian changed the title InputMethodManager.mCurRootView memory leak in Android6.0 with huawei mobile phone InputMethodManager.mLastSrvView memory leak in Android6.0 with huawei mobile phone Jul 27, 2016
@Yky
Copy link
Contributor

Yky commented Jul 27, 2016

Leaks for certain manufacturers are also added to AndroidExcludedRefs. You can file a pull request with your desired addition.

@ximencx
Copy link

ximencx commented Jul 30, 2016

I have same question , how to deal with ? thanks

@pyricau
Copy link
Member

pyricau commented Sep 19, 2016

Thank you for your report, it looks like this might be a leak in the Android SDK.

Please read the following entry in our FAQ: Can a leak be caused by the Android SDK?.

We don't have enough time to do the investigative work on this type of issue, so I will close this issue for now. We'll happily take contributions to AndroidExcludedRefs.java, if the leak is demonstrated and the fix provided to AOSP.

@pyricau pyricau closed this as completed Sep 19, 2016
@calvarez-ov
Copy link

Too bad this was closed, I'm seeing it too.

@calvarez-ov
Copy link

calvarez-ov commented Apr 11, 2017

For info, for people wanting to hide this temporarily to focus on leaks in their own code, the following seems to ignore it. In my case, I saw it from a SearchView.SearchAutoComplete field, so I guess if you see it from a TextView you'd need to add a rule for that.

            ExcludedRefs excludedRefs = AndroidExcludedRefs.createAppDefaults()
                    .instanceField("android.view.inputmethod.InputMethodManager", "sInstance")
                    .instanceField("android.view.inputmethod.InputMethodManager", "mLastSrvView")
                    .instanceField("com.android.internal.policy.PhoneWindow$DecorView", "mContext")
                    .instanceField("android.support.v7.widget.SearchView$SearchAutoComplete", "mContext")
                    .build();

            LeakCanary.refWatcher(this)
                    .listenerServiceClass(DisplayLeakService.class)
                    .excludedRefs(excludedRefs)
                    .buildAndInstall();

@ckwcc
Copy link

ckwcc commented Jan 11, 2018

where should these code be writted?

@MIkeeJY
Copy link

MIkeeJY commented Oct 23, 2018

@ckwcc Just init in your CustomApplication.java

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

7 participants