We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1fb9049 + c3fb7a1 commit a1277deCopy full SHA for a1277de
core/java/android/text/TextLine.java
@@ -102,6 +102,11 @@ static TextLine recycle(TextLine tl) {
102
tl.mText = null;
103
tl.mPaint = null;
104
tl.mDirections = null;
105
+
106
+ tl.mMetricAffectingSpanSpanSet.recycle();
107
+ tl.mCharacterStyleSpanSet.recycle();
108
+ tl.mReplacementSpanSpanSet.recycle();
109
110
synchronized(sCached) {
111
for (int i = 0; i < sCached.length; ++i) {
112
if (sCached[i] == null) {
@@ -919,6 +924,12 @@ int getNextTransition(int start, int limit) {
919
924
}
920
925
return limit;
921
926
927
928
+ public void recycle() {
929
+ for (int i = 0; i < numberOfSpans; i++) {
930
+ spans[i] = null; // prevent a leak: no reference kept when TextLine is recycled
931
+ }
932
922
933
923
934
935
/**
0 commit comments