Closed mockersf closed 5 months ago
Assuming it's not a wgpu issue (e.g. https://github.com/gfx-rs/wgpu/issues/5707, which I'm not sure if it applies to 0.19 or not), this PR https://github.com/bevyengine/bevy/pull/12459 probably broke it.
Can you run a git bisect and see if it worked before #12459?
EDIT: Also try adding a print statement here and seeing if assets are properly dropped.
EDIT2: Could also have been https://github.com/bevyengine/bevy/pull/12827 breaking something.
I added a Drop impl to GpuImage and ran the example. I see all the images being dropped. If there's memory leaks, I think it's on wgpu's side.
@JMS55 the GpuUimage
is dropped, but the bind group was kept, keeping the memory used. #13609 fixes that
Bevy version
0.13 and main
What you did
load many images, set them as
RenderAssetUsages::RENDER_WORLD
, display them then drop themWhat went wrong
GPU memory is not freed
Additional information
first video images are loaded as
RenderAssetUsages::all()
, all displayed, then all the entities are despawned, there are no strong handles left CPU and GPU memory are freed, as can be seen in the metal HUDhttps://github.com/bevyengine/bevy/assets/8672791/9dd0aec0-7b2c-4024-bece-75484ddc9bf5
second video images are loaded as
RenderAssetUsages:: RENDER_WORLD
, all displayed, then all the entities are despawned, there are no strong handles left CPU memory is freed as soon as the images are sent to the GPU, GPU memory is never freedhttps://github.com/bevyengine/bevy/assets/8672791/5acbe238-fd29-42dc-bd27-754f664a1d2f
Example code
this example loads all the images in the Bevy repo ```rust use bevy::{ prelude::*, render::{render_asset::RenderAssetUsages, texture::ImageLoaderSettings}, }; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(Update, (drop_handles, update_asset_count)) .run(); } fn setup(mut commands: Commands, asset_server: Res