!17349 fix memory leak

Merge pull request !17349 from chuchengcheng/cherry-pick-1732195321
This commit is contained in:
openharmony_ci 2024-11-21 14:42:48 +00:00 committed by Gitee
commit 0862c0c5be
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -49,7 +49,11 @@ RSImageBase::~RSImageBase()
#endif
pixelMap_ = nullptr;
if (uniqueId_ > 0) {
RSImageCache::Instance().CollectUniqueId(uniqueId_);
if (renderServiceImage_ || isDrawn_) {
RSImageCache::Instance().CollectUniqueId(uniqueId_);
} else {
RSImageCache::Instance().ReleasePixelMapCache(uniqueId_);
}
}
#if defined(ROSEN_OHOS) && defined(RS_ENABLE_VK)
if (RSSystemProperties::GetGpuApiType() == GpuApiType::VULKAN ||