EvergineTeam / WebGPU.NET

This repository contains low-level bindings for WebGPU used in Evergine.
MIT License
84 stars 8 forks source link

Memory Leak in HelloTriangle example #16

Open macromaniac opened 1 week ago

macromaniac commented 1 week ago

Hi, great project.

In your HelloTriangle.csproj example there is a memory leak caused by not releasing the render pass encoder, view the diagnostic tools window in visual studio and observe the memory go up over time.

Recommend adding on line 383 of HelloTriangle.cs wgpuRenderPassEncoderRelease(renderPass);

macromaniac commented 1 week ago

Also I think wgpuCommandBufferRelease(command); on line 393 too, there is still a light memory leak (.8 MB a minute), no clue where its coming from- it could be in the underlying lib, but it is 10x better with these two lines added

edit: seems like the .8 MB a minute is very likely a known wgpu bug that should be fixed in the next version, I found a workaround by releasing the underlying surface texture every frame but it is a bit ghetto so probably we shouldn't worry about it