summaryrefslogtreecommitdiff
path: root/libs/hwui/GpuMemoryTracker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/GpuMemoryTracker.cpp')
-rw-r--r--libs/hwui/GpuMemoryTracker.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/hwui/GpuMemoryTracker.cpp b/libs/hwui/GpuMemoryTracker.cpp
index a9a7af8f22f3..612bfde1a3fa 100644
--- a/libs/hwui/GpuMemoryTracker.cpp
+++ b/libs/hwui/GpuMemoryTracker.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include "Texture.h"
#include "utils/StringUtils.h"
#include <GpuMemoryTracker.h>
@@ -116,6 +117,22 @@ void GpuMemoryTracker::onFrameCompleted() {
ATRACE_INT(buf, stats.count);
}
}
+
+ std::vector<const Texture*> freeList;
+ for (const auto& obj : gObjectSet) {
+ if (obj->objectType() == GpuObjectType::Texture) {
+ const Texture* texture = static_cast<Texture*>(obj);
+ if (texture->cleanup) {
+ ALOGE("Leaked texture marked for cleanup! id=%u, size %ux%u", texture->id(),
+ texture->width(), texture->height());
+ freeList.push_back(texture);
+ }
+ }
+ }
+ for (auto& texture : freeList) {
+ const_cast<Texture*>(texture)->deleteTexture();
+ delete texture;
+ }
}
} // namespace uirenderer