Search code examples
androidfacebookmemory-leakschromiumleakcanary

Android Chrome Facebook webview memory leak using Leakcanary


Randomly I'm having this leaks after performing login with Facebook Webview

enter image description here enter image description here enter image description here

I've found this (the only mention to com.android.org.chromium):

AW_RESOURCE__SRESOURCES(SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    @Override void add(ExcludedRefs.Builder excluded) {
      // AwResource#setResources() is called with resources that hold a reference to the
      // activity context (instead of the application context) and doesn't clear it.
      // Not sure what's going on there, input welcome.
      excluded.staticField("com.android.org.chromium.android_webview.AwResource", "sResources");
    }
  },

Inside this class AndroidExcludedRefs.java

This class is a work in progress. You can help by reporting leak traces that seem to be caused by the Android SDK, here: https://github.com/square/leakcanary/issues/new

But I'm not using Samsung so I'm still having this leak.
Said that, is this leak a known issue? Can it be ignored?

UPDATE: I was using Facebook SDK v3.19, I've updated to 4.3 but the problem remains: enter image description here


Solution

  • So I've been in contact with facebook support center and the conclusion we've reached was:

    Your intuition was correct. This seems to be a bug in chrome and not our SDK. It should be fixed in later versions of android since it was fixed in April of this year.

    See: https://code.google.com/p/chromium/issues/detail?id=478719