mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 22:50:19 +00:00
a1a07945d6
The first leak: ```rust #[test] fn blob_vec_drop_empty_capacity() { let item_layout = Layout:🆕:<Foo>(); let drop = drop_ptr::<Foo>; let _ = unsafe { BlobVec::new(item_layout, Some(drop), 0) }; } ``` this is because we allocate the swap scratch in blobvec regardless of what the capacity is, but we only deallocate if capacity is > 0 The second leak: ```rust #[test] fn panic_while_overwriting_component() { let helper = DropTestHelper::new(); let res = panic::catch_unwind(|| { let mut world = World::new(); world .spawn() .insert(helper.make_component(true, 0)) .insert(helper.make_component(false, 1)); println!("Done inserting! Dropping world..."); }); let drop_log = helper.finish(res); assert_eq!( &*drop_log, [ DropLogItem::Create(0), DropLogItem::Create(1), DropLogItem::Drop(0), ] ); } ``` this is caused by us not running the drop impl on the to-be-inserted component if the drop impl of the overwritten component panics --- managed to figure out where the leaks were by using this 10/10 command ``` cargo --quiet test --lib -- --list | sed 's/: test$//' | MIRIFLAGS="-Zmiri-disable-isolation" xargs -n1 cargo miri test --lib -- --exact ``` which runs every test one by one rather than all at once which let miri actually tell me which test had the leak 🙃 |
||
---|---|---|
.. | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |