Framebuffer does not release depth buffer when destroyed, causing GPU memory leak
See original GitHub issueI noticed that if you (manually) add a depth texture to a Framebuffer, that texture does NOT get cleaned up by calling destroy() on the framebuffer, although arguably, it should, since it belongs to the buffer.
Expected Behavior
The depth texture gets destroyed alongside all the color textures.
Current Behavior
The color textures get destroyed while the depth texture doesn’t, causing a memory leak.
Possible Solution
Add destruction of the depth texture when destroying the framebuffer.
Steps to Reproduce
I created a commented Fiddle that can help with reproducing the problem: https://jsfiddle.net/ncj95301/
Click “Start”, then check your VRAM usage, it should go up quite quickly.
Environment
pixi.js
version: 5.2.1- Browser & Version: Chrome 80.0.3987.163
- OS & Version: Windows 10.0.18362 Build 18362
- Running Example: _https://jsfiddle.net/ncj95301/_
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Framebuffer does not release depth buffer when destroyed ...
The color textures get destroyed while the depth texture doesn't, causing a memory leak. Possible Solution. Add destruction of the depth texture ......
Read more >Common Mistakes - OpenGL Wiki - Khronos Group
Assuming all of that has been set up correctly, your framebuffer may not have a depth buffer at all. This is easy to...
Read more >gpu/command_buffer/service/gles2_cmd_decoder.cc
void Destroy();. // Invalidate the frame buffer. This can be used when a context is lost and it. // is not possible to...
Read more >Memory Leaks in Lightning - Tutorials - LightningJS Forum
A memory leak is a phenomenon where memory resources are being allocated and not being released or sometimes not being released quick enough ......
Read more >How to correctly load/unload textures from video memory?
I've tried re-using IDs for buffers, textures, renderbuffers & framebuffers. All but re-using framebuffers are working so far, but memory is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Verified, the leak is gone.
@Vanilagy Please verify the fix: https://jsfiddle.net/ShukantPal/6jqsfa7v/