Description
HMSTextureView doesn't release its renderer when it's disposed. HMSVideoView does, so the two paths behave differently: every texture view that gets built and later removed leaves a render thread and an EGL context behind for the lifetime of the process.
Anything that recreates the views multiplies it: route changes, layout changes, tracks being re-attached. They're never reused and there's no way to release them from the Dart side, so the count only goes up.
In video-view 2.9.83, HMSTextureRenderer.release() only calls SurfaceEglRenderer.releaseEglSurface(), and nothing ever calls EglRenderer.release(), so the HandlerThread started in EglRenderer.init() keeps running. HMSVideoView extends SurfaceViewRenderer, so its release ends up in the real EglRenderer.release(), which is why only the texture path leaks.
A PR with a fix follows right after this.
100ms Flutter Version
1.11.1
Steps to reproduce
- Render any track with HMSTextureView and then remove it from the tree. Repeat a few times.
- Check the app's threads (adb shell ps -T -p -o CMD): the renderer threads are named after the renderer UUID and their number keeps growing.
- Leave the room. They're still there.
- Run the same test with HMSVideoView instead: the count stays flat.
Expected results
Disposing an HMSTextureView releases its renderer, the same way HMSVideoView does, so the thread count drops back to zero after leaving the room. Instead it grows by roughly one per built view and never comes down.
Code example, screenshot, or link to a repository
Nothing unusual is needed, this is the example app plus a route:
// any track rendered with the texture view
HMSTextureView(track: track)
// building and disposing that subtree is enough
Navigator.push(context, MaterialPageRoute(builder: (_) => const VideoPage()));
Navigator.pop(context);
Any layout change that recreates the tiles does the same thing.
Logs
Logs
<!-- Paste your logs here -->
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.44.2, on macOS 15.6.1 24G90 darwin-arm64, locale en-US)
• Flutter version 3.44.2 on channel stable
• Framework revision c9a6c48423, 2026-06-10
• Engine revision 77e2e94772
• Dart version 3.12.2
[✓] Android toolchain (Android SDK version 36.1.0)
• Platform android-36, build-tools 36.1.0
• Java version OpenJDK Runtime Environment (build 21.0.9)
[✓] Xcode 26.3, Build 17C529
• CocoaPods version 1.17.0
[✓] Connected device
• Pixel 6 (mobile) • android-arm64 • Android 17 (API 37)
Description
HMSTextureView doesn't release its renderer when it's disposed. HMSVideoView does, so the two paths behave differently: every texture view that gets built and later removed leaves a render thread and an EGL context behind for the lifetime of the process.
Anything that recreates the views multiplies it: route changes, layout changes, tracks being re-attached. They're never reused and there's no way to release them from the Dart side, so the count only goes up.
In video-view 2.9.83, HMSTextureRenderer.release() only calls SurfaceEglRenderer.releaseEglSurface(), and nothing ever calls EglRenderer.release(), so the HandlerThread started in EglRenderer.init() keeps running. HMSVideoView extends SurfaceViewRenderer, so its release ends up in the real EglRenderer.release(), which is why only the texture path leaks.
A PR with a fix follows right after this.
100ms Flutter Version
1.11.1
Steps to reproduce
Expected results
Disposing an HMSTextureView releases its renderer, the same way HMSVideoView does, so the thread count drops back to zero after leaving the room. Instead it grows by roughly one per built view and never comes down.
Code example, screenshot, or link to a repository
Nothing unusual is needed, this is the example app plus a route:
Any layout change that recreates the tiles does the same thing.
Logs
Logs
<!-- Paste your logs here -->Flutter Doctor output
Doctor output