Fix leaked textures on resolution change and quit#277
Open
MaxHeimbrock wants to merge 1 commit intomainfrom
Open
Fix leaked textures on resolution change and quit#277MaxHeimbrock wants to merge 1 commit intomainfrom
MaxHeimbrock wants to merge 1 commit intomainfrom
Conversation
Video sources (WebCameraSource, CameraVideoSource, ScreenVideoSource) reallocated their RenderTexture/Texture2D/NativeArray on resize without releasing the previous instances, leaving the old GPU and native allocations to leak. Dispose() also did not free the RenderTexture/_tempTexture in the camera source paths. Meet sample's MeetManager.OnDestroy did not clean up tracks and streams when the scene is destroyed while still connected, leaking everything CleanUpAllTracks would have released. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes texture/buffer leaks in the video source paths and on Meet sample shutdown.
WebCameraSource,CameraVideoSource,ScreenVideoSource: each one reallocatedRenderTexture/Texture2D/NativeArray<byte>when the source resolution changed, but did not release/destroy/dispose the previous instances first. The old GPU and native allocations leaked on every resize.WebCameraSource.Dispose: previously did not release_tempTexture(the parentRtcVideoSource.Disposeonly frees_previewTextureand_captureBuffer). Added an override.CameraVideoSource.Dispose/ScreenVideoSource.Dispose: previously had aClearRenderTexture()that only calledRelease()(noObject.Destroy), and was not invoked fromDispose. Added overrides that fully release + destroy the_renderTexturewhen called from user code.MeetManager.OnDestroy: only stopped theWebCamTexture. If the scene was destroyed (or app quit) while still in a call, every track, stream, and tile remained allocated. Now disconnects the room and runsCleanUpAllTracks().These bugs primarily compound on resolution changes (camera flips, screen resizes, orientation changes) and on app/scene shutdown — they don't fully explain steady-state per-frame growth, but they do contribute to long-running session bloat.
Test plan
🤖 Generated with Claude Code