Skip to content

Commit 75394d6

Browse files
committed
Fix bug 6558006: SystemUI native heap is huge. Fix memory leak
TextLayoutCache was leaking HB_Face objects, not freeing them when purging the mCachedHBFaces cache. More full analysis is in the bug. Change-Id: Ie5cd8b00c36b9d31963183c601cde49cbb73fafb
1 parent 561ff8a commit 75394d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/jni/android/graphics/TextLayoutCache.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,10 @@ HB_Face TextLayoutShaper::getCachedHBFace(SkTypeface* typeface) {
992992
}
993993

994994
void TextLayoutShaper::purgeCaches() {
995+
size_t cacheSize = mCachedHBFaces.size();
996+
for (size_t i = 0; i < cacheSize; i++) {
997+
HB_FreeFace(mCachedHBFaces.valueAt(i));
998+
}
995999
mCachedHBFaces.clear();
9961000
unrefTypefaces();
9971001
init();

0 commit comments

Comments
 (0)