-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Bevy version
0.15.3, 0.16.0-dev
[Optional] Relevant system information
`AdapterInfo { name: "NVIDIA GeForce GTX 1070", vendor: 4318, device: 7041, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "572.60", backend: Vulkan }`
What you did
I want to update many meshes in parallel. I start by collecting the meshes with meshes.remove(handle)
, update the meshes in a par_splat_map_mut
, then reinsert the meshes with meshes.insert(handle, mesh)
.
Simplified code: https://gist.github.com/g-pascal/eeab0d104fe8f2725b36c3bfb2c034e2
What went wrong
The process crashed after a few minutes due to a failed memory allocation. Looking at the Windows task manager it is quite clear there is a leak somewhere:

Additional information
This seems related to #16586 which fixed leaks caused by simply using meshes.get_mut(handle)
. I'm having the same issue but when inserting an already allocated mesh with an existing handle:
let mesh = meshes.remove(&*mesh_handle).unwrap();
// update mesh...
meshes.insert(mesh_handle, mesh);
The leak also happens when the mesh is not updated at all, simply removing it and reinserting it causes the same issue.
Minimal reproduction: https://gist.github.com/g-pascal/08ad6f56ea4699ecefb25cb65945ee75