summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorHiroshi Lockheimer <hiroshi@google.com>2012-09-27 22:23:28 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-27 22:23:28 -0700
commita7a257d6578cf37723d92b4b90c6ef9caea18528 (patch)
treefb5cd6ced9bbcc1e0481d8959bb588709727bfa7 /libs
parent448f6e1e1471db2caf218ca8918c2d82306b450a (diff)
parent034de6b1ec561797a2422314e6ef03e3cd3e08e0 (diff)
downloadframeworks_base-a7a257d6578cf37723d92b4b90c6ef9caea18528.zip
frameworks_base-a7a257d6578cf37723d92b4b90c6ef9caea18528.tar.gz
frameworks_base-a7a257d6578cf37723d92b4b90c6ef9caea18528.tar.bz2
Merge "Plug memory leak that happens when reusing display lists Bug #7195815" into jb-mr1-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/DisplayListRenderer.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 6aff8d4..6ca70a4 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -143,6 +143,7 @@ void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) {
void DisplayList::clearResources() {
sk_free((void*) mReader.base());
+ mReader.setMemory(NULL, 0);
delete mTransformMatrix;
delete mTransformCamera;
@@ -216,19 +217,19 @@ void DisplayList::clearResources() {
void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing) {
const SkWriter32& writer = recorder.writeStream();
- init();
-
- if (writer.size() == 0) {
- mFunctorCount = 0;
- return;
- }
if (reusing) {
// re-using display list - clear out previous allocations
clearResources();
}
+
+ init();
initProperties();
+ if (writer.size() == 0) {
+ return;
+ }
+
mSize = writer.size();
void* buffer = sk_malloc_throw(mSize);
writer.flatten(buffer);
@@ -301,6 +302,7 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde
void DisplayList::init() {
mSize = 0;
mIsRenderable = true;
+ mFunctorCount = 0;
}
size_t DisplayList::getSize() {