如何修复AccessibilityNodeInfo内存泄漏

时间:2018-11-02 06:08:40

标签: android memory memory-leaks

enter image description here

我可能了解它的工作原理,但我不知道要修复它

如何在AccessibilityNodeInfo.clear()中将mOriginText设置为null?

  ACCESSIBILITY_NODE_INFO__MORIGINALTEXT(SDK_INT >= O && SDK_INT <= O_MR1) {
@Override void add(ExcludedRefs.Builder excluded) {
  excluded.instanceField("android.view.accessibility.AccessibilityNodeInfo", "mOriginalText")
      .reason("AccessibilityNodeInfo has a static sPool of AccessibilityNodeInfo. When "
          + "AccessibilityNodeInfo instances are released back in the pool, "
          + "AccessibilityNodeInfo.clear() does not clear the mOriginalText field, which "
          + "causes spans to leak which in turns causes TextView.ChangeWatcher to leak and the "
          + "whole view hierarchy. Introduced here: https://android.googlesource.com/platform/"
          + "frameworks/base/+/193520e3dff5248ddcf8435203bf99d2ba667219%5E%21/core/java/"
          + "android/view/accessibility/AccessibilityNodeInfo.java");
}

0 个答案:

没有答案