Skip to content

WebGLRenderer: Improve texture disposal. - #34530

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
Mugen87:dev2
Sep 10, 2026
Merged

WebGLRenderer: Improve texture disposal.#34530
Mugen87 merged 1 commit into
mrdoob:devfrom
Mugen87:dev2

Conversation

@Mugen87

@Mugen87 Mugen87 commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Closes #34519.

Description

The PR makes textures don't keep renderer memory alive even if renderer.dispose() has been called. That happens because dispose event listeners keep references to internal entities and they are never removed in dispose. This change applies the same principle from WebGPURenderer to WebGLRenderer. Similar to #34529, we use a combination of WeakRef and FinalizationRegistry to make sure we can implement a WebGLTextures.dispose() the renderer can call to clean everything up.

@Mugen87 Mugen87 added this to the r187 milestone Sep 10, 2026
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
Core 389.51
102.17
389.51
102.17
+0 B
+0 B
WebGL 378.65
88.76
379.11
88.92
+456 B
+158 B
WebGPU 711.13
195.69
711.13
195.69
+0 B
+0 B
WebGPU Nodes 709.12
195.38
709.12
195.38
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 523.27
125.92
523.73
126.08
+456 B
+150 B
WebGPU 765.12
205.27
765.12
205.27
+0 B
+0 B
WebGPU Nodes 711.21
191.93
711.21
191.93
+0 B
+0 B

@Mugen87
Mugen87 merged commit 268b8d1 into mrdoob:dev Sep 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant