summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Patch.cpp
diff options
context:
space:
mode:
authorJens Gulin <jens.gulin@sonymobile.com>2014-02-04 17:38:02 +0100
committerTakeshi Aimi <takeshi.aimi@sonymobile.com>2014-03-25 09:37:02 +0900
commit6056e1027107aaa15f51a5ed775ff14c6b664ca3 (patch)
tree1337c3e4d996bb3528f9c92531a95ce30fd860c1 /libs/hwui/Patch.cpp
parent557a93e104f1fec69ed05b2d0ff26c78bca4c5d6 (diff)
downloadframeworks_base-6056e1027107aaa15f51a5ed775ff14c6b664ca3.zip
frameworks_base-6056e1027107aaa15f51a5ed775ff14c6b664ca3.tar.gz
frameworks_base-6056e1027107aaa15f51a5ed775ff14c6b664ca3.tar.bz2
Solve three memory leaks related to PatchCache
A Patch can be fairly large, holding bitmap data, but is also frequently leaked which adds to the severity. The feature is used in many important processes such as Home, SystemUI and Chrome. The following leaks are solved: 1. The Patch itself was not always freed. PatchCache::removeDeferred() can mark patches to be cared for by PatchCache::clearGarbage(). But mCache.remove() would only destroy the container and the pointer, not the Patch object itself. 2. The vertices stored in the Patch at Patch::createMesh() would always leak. The empty/default destructor in Patch would not properly destroy "vertices" since it's just a pointer. 3. A BufferBlock that's added to the mFreeBlocks in PatchCache could leak. The leak happened when a patch later needed the entire free block, because the object was removed from the list but never deleted in PatchCache::setupMesh(). Change-Id: I41e60824479230b67426fc546d3dbff294c8891f
Diffstat (limited to 'libs/hwui/Patch.cpp')
-rw-r--r--libs/hwui/Patch.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp
index b2148b0..442e9ba 100644
--- a/libs/hwui/Patch.cpp
+++ b/libs/hwui/Patch.cpp
@@ -36,6 +36,7 @@ Patch::Patch(): vertices(NULL), verticesCount(0), indexCount(0), hasEmptyQuads(f
}
Patch::~Patch() {
+ delete[] vertices;
}
///////////////////////////////////////////////////////////////////////////////