question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Framebuffer does not release depth buffer when destroyed, causing GPU memory leak

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Vanilagycommented, Apr 15, 2020

Verified, the leak is gone.

0reactions
ShukantPalcommented, Apr 15, 2020
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found