History log of /frameworks/base/core/java/android/text/SpanSet.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b3a9bc038d3a218b1dbdf7b5668e3d6c12be5ee4 07-Apr-2015 Romain Guy <romainguy@curious-creature.com> Prevent possible memory leak in SpanSet

If SpanSet.init() is called several times in a row with different
values, it is possible to change "numberOfSpans" in a way that
will prevent SpanSet.recycle() from nulling out all the spans.

This can lead to memory leaks of large objects through spans
references. User @piwai reported this leak:

com.squareup.marketfont.MarketSpan
`-[1] of array android.text.style.CharacterStyle[]
`-spans of object android.text.SpanSet
`-mCharacterStyleSpanSet of object android.text.TextLine
`-[1] of array android.text.TextLine[]
`-sCached of class android.text.TextLine

The MarketSpan instance is kept alive through a recycled TextLine
which itself contains a SpanSet.

Change-Id: Idfb2233ca16895dbe735c312662eaf0b4a2ecd65
/frameworks/base/core/java/android/text/SpanSet.java
4ffb879f4866f7d51070bfc9d10e7a2fdac62d4c 13-Mar-2012 Gilles Debunne <debunne@google.com> New SpanSet class extracted from TextLine.

Change-Id: I424dbd7ff0693fd465b6c83ebabba221b2eca6fe
/frameworks/base/core/java/android/text/SpanSet.java