am a1277de3: Merge "Prevent a memory leak in TextLine." into ics-mr1
* commit 'a1277de3c393fb0861d26ec5551ae4247e32dee4': Prevent a memory leak in TextLine.
This commit is contained in:
@@ -102,6 +102,11 @@ class TextLine {
|
||||
tl.mText = null;
|
||||
tl.mPaint = null;
|
||||
tl.mDirections = null;
|
||||
|
||||
tl.mMetricAffectingSpanSpanSet.recycle();
|
||||
tl.mCharacterStyleSpanSet.recycle();
|
||||
tl.mReplacementSpanSpanSet.recycle();
|
||||
|
||||
synchronized(sCached) {
|
||||
for (int i = 0; i < sCached.length; ++i) {
|
||||
if (sCached[i] == null) {
|
||||
@@ -919,6 +924,12 @@ class TextLine {
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void recycle() {
|
||||
for (int i = 0; i < numberOfSpans; i++) {
|
||||
spans[i] = null; // prevent a leak: no reference kept when TextLine is recycled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user