bkaradzic / bgfx

Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
https://bkaradzic.github.io/bgfx/overview.html
BSD 2-Clause "Simplified" License
15.14k stars 1.95k forks source link

GPU memory leak according to stats when calling bgfx::reset #2563

Open cykoder opened 3 years ago

cykoder commented 3 years ago

Describe the bug When you call bgfx::reset, such as when resizing a window, there is a GPU memory leak according to BGFX stats.

To Reproduce Steps to reproduce the behavior:

  1. Go to any example
  2. Ensure stats are enabled
  3. Resize the window
  4. Watch GPU mem stat keep growing

Expected behavior Should maintain its level

Additional context Tested on Linux with OpenGL and Vulkan backends

bkaradzic commented 3 years ago

Are you sure it's leak? If I resize window to smaller size it reduces the memory usage.

cykoder commented 3 years ago

Try spamming resizing of the window to small then large again, I can record a video of it helps and you can’t reproduce

On Wed, 21 Jul 2021 at 03:33, Бранимир Караџић @.***> wrote:

Are you sure it's leak? If I resize window to smaller size it reduces the memory usage.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bkaradzic/bgfx/issues/2563#issuecomment-883838796, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYL3UKSWEDXEIT2HXBTLDDTYYWXFANCNFSM5AW5Z64Q .

bkaradzic commented 3 years ago

Yeah I did, but once I went to smaller size it reduced amount of memory back below what was at starting point.

cykoder commented 3 years ago

Here's a video of the problem: https://user-images.githubusercontent.com/3194321/126576759-85c0d2da-b09c-4056-b0aa-a00e3ea7df86.mp4

Its odd how the total GPU mem stat goes up too, maybe its a tracking glitch than an actual memory leak?

bkaradzic commented 3 years ago

Press F1 and record what's there. I'm definitely don't see this issue on my machine.

What driver/GPU combo you have?

cykoder commented 3 years ago

in this screenshot gpu mem is at 1627.31mb/6.74gb in stats window

image

OS: Manjaro 21.1.0 Pahvo Kernel: x86_64 Linux 5.10.49-1-MANJARO GPU: NVIDIA GeForce RTX 2060

Drivers are nvidias image

bkaradzic commented 3 years ago

Remove RenderDoc and see is it still leaking...

bkaradzic commented 3 years ago

@SamHellawell Did you have chance to test without RenderDoc?

cykoder commented 3 years ago

@bkaradzic sorry busy few days, here's without renderdoc - result seems same

image

cykoder commented 3 years ago

I'll try to run the example and see if I get the same results on windows over the weekend

cykoder commented 3 years ago

This doesn't happen on windows with direct3d renderer