-
Notifications
You must be signed in to change notification settings - Fork 960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WGPU leaks the implicit PLL of pipeline layouts #5029
Comments
In Discord cwfitzgerald had the following to say:
|
@DevJac it looks like you recreate the render pipeline every time I don't think it (recreating the pipeline every time) should be necessary because in my wgpu application I hold on to a reference to the Would an implicit PLL imply an implicit There is a wgpu tutorial that is careful about managing state and definitely keeps its Also, I've found that wgpu makes good use of Also, to be clear:
|
Yes, my code is not optimized. Also, this code is what's left over after simplifying and removing almost everything else. I wanted to focus on writing simple and clean Rust code first, then profile, then optimize where it makes sense. You're right, it is not optimal to recreate the pipeline and recompile the shaders and everything else I'm doing every single frame, but I'm still getting 1000 FPS currently, so it's fast enough. My plan was to optimize when needed, and the optimization will be easy since the code is simple. Whatever the case, this code is not optimal, but it's not doing anything wrong, and I believe WGPU should not be leaking. I'm aware that if I need a workaround, I can avoid recreating the pipeline (etc) over and over and that will work around the memory leak. Ideally the memory leak would be fixed one way or another. |
Yup, this leak shouldn't be happening and we should fix it, no matter what the code is actually doing |
I wonder if this is #3572. |
This is caused by the |
This 300 line graphics application leaks memory: https://github.com/DevJac/life_sim/blob/36a55a1a4762bb140d1fed2f04011e7f3d030203/src/main.rs
The code is in a single file, which I've also attached to this issue if needed for future reference.
main.txt
My render code is unusual because it recreates the pipeline each frame, I'm learning so I've been focused on forward progress rather than optimal code.
After 10,123 frames rendered, I get the following report from Instance:
or formatted:
Notice the number of pipeline_layouts equals the number of frames rendered. This appears to be the memory leak. The counts of all other objects are low.
The text was updated successfully, but these errors were encountered: