filament
filament copied to clipboard
Memory leak in readPixels using vulkan backend
Describe the bug When calling readPixels while using the Vulkan backend there appears to be a memory leak of about 2MB per call. This was tested using the MSVC debuggers memory snapshot tool. Note that when testing using the OpenGL backend this issue does not seem to occur.
To Reproduce Steps to reproduce the behavior:
- Run the GLTF-viewer tool under the MSVC debugger using the Vulkan backend
- Take note of the program memory usage
- Tick the export screenshots checkbox and run tests
- After running ~200 test cases the memory usage has gone up by 400MB in my case (Using default resolution and having loaded the GLTF-samples avocado model)
Expected behavior I would expect the memory usage to drop back to the value that it had before starting the test cases after stopping the testing in the GLTF-Viewer
Desktop (please complete the following information):
- OS: Windows 11
- GPU: NVIDIA RTX 3060
- Backend: Vulkan
Additional context
Not sure if relevant or if they are false positives but the debugger seem to think that the allocations are made mainly during the calls to vkBindImageMemory
, vkGetImageMemoryRequirements
, and mContext.commands->flush();
in VulkanDriver::readPixels
I've reproduced this on a mac by looking at Activity Monitor and using MoltenVK. This is a regression but a potentially very old regression, since I haven't tried this in a while. Will TAL. Thanks for the bug report!
@pixelflinger this might be a good starter issue for someone being introduced to the Vulkan codebase.