You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
If you create new render pipelines and pipeline layouts at runtime, they're never freed/destroyed, which causes a reliable memory leak.
Notably, even though the render pipeline and pipeline layouts are dropped, destroy_pipeline_layout is never called.
Since my actual program creates a new pipeline and pipeline layout often, it causes a massive memory leak that leaks 1 GB of RAM in ~30 seconds, making wgpu completely unusable.
Repro steps
I modified the cube example to showcase this issue. This patch makes it recreate the pipeline(s) and pipeline layouts every frame:
This is very similar to what my real program is doing, and exhibits the exact same issue.
Expected vs observed behavior
It should drop the render pipeline and pipeline layouts, and eventually free the backed descriptors. It should not leak memory over time.
Instead we see a reliable memory leak of about 1 MB per second.
If we run a heap profiler, we see create_pipeline_layout is leaking huge amounts of memory.
If we set a breakpoint on destroy_pipeline_layout:
b wgpu_hal::vulkan::device::<impl wgpu_hal::Device<wgpu_hal::vulkan::Api> for wgpu_hal::vulkan::Device>::destroy_pipeline_layout
It's never called while the program is running, and not at all until the example is exited.
This seems related to #582 (cc @kvark), I suspect the refcounts may never be hitting 1 for some reason?
Platform
wgpu v0.12 on Linux with proprietary NVidia drivers
The text was updated successfully, but these errors were encountered:
Description
If you create new render pipelines and pipeline layouts at runtime, they're never freed/destroyed, which causes a reliable memory leak.
Notably, even though the render pipeline and pipeline layouts are dropped,
destroy_pipeline_layout
is never called.Since my actual program creates a new pipeline and pipeline layout often, it causes a massive memory leak that leaks 1 GB of RAM in ~30 seconds, making wgpu completely unusable.
Repro steps
I modified the cube example to showcase this issue. This patch makes it recreate the pipeline(s) and pipeline layouts every frame:
This is very similar to what my real program is doing, and exhibits the exact same issue.
Expected vs observed behavior
It should drop the render pipeline and pipeline layouts, and eventually free the backed descriptors. It should not leak memory over time.
Instead we see a reliable memory leak of about 1 MB per second.
If we run a heap profiler, we see
create_pipeline_layout
is leaking huge amounts of memory.If we set a breakpoint on
destroy_pipeline_layout
:It's never called while the program is running, and not at all until the example is exited.
This seems related to #582 (cc @kvark), I suspect the refcounts may never be hitting 1 for some reason?
Platform
wgpu v0.12 on Linux with proprietary NVidia drivers
The text was updated successfully, but these errors were encountered: