From 2c71fa8e1b46313a062c3f2a045e70543599bf6d Mon Sep 17 00:00:00 2001 From: ColdPaleLight <31977171+ColdPaleLight@users.noreply.github.com> Date: Tue, 24 Aug 2021 22:59:02 +0800 Subject: [PATCH] Fix memory leak in FlutterDarwinExternalTextureMetal (flutter/engine#28059) --- .../darwin/graphics/FlutterDarwinExternalTextureMetal.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm index 2dc6febb04..5618f75a41 100644 --- a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm +++ b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm @@ -39,6 +39,9 @@ FLUTTER_ASSERT_ARC - (void)dealloc { CVPixelBufferRelease(_lastPixelBuffer); if (_textureCache) { + CVMetalTextureCacheFlush(_textureCache, // cache + 0 // options (must be zero) + ); CFRelease(_textureCache); } }