From 67af994c6cafde37483aac818c89a7482fa07ca4 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Wed, 12 Aug 2015 13:55:37 -0700 Subject: [PATCH] Clear SuggestionsPopupWindow.mSpansLengths after it is used. This is a no risk optimization that minimizes the time when strong references to SuggestionSpan and Integer instances are hold in SuggestionsPopupWindow.mSpansLengths. SuggestionsPopupWindow.mSpansLengths are used while the given SuggestionSpans array is being sorted. We don't need to keep object references there after the sort is completed. No user visible change is intended with this CL. Change-Id: I7882d741c08d07ad7f905ad1d171c0d13da39397 --- core/java/android/widget/Editor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 15353bbd2d31d..de618986b56ac 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -2793,6 +2793,8 @@ public class Editor { // The suggestions are sorted according to their types (easy correction first, then // misspelled) and to the length of the text that they cover (shorter first). Arrays.sort(suggestionSpans, mSuggestionSpanComparator); + mSpansLengths.clear(); + return suggestionSpans; }