From dd557c8f293dbef3e2e881bcb1a85a7697a1ebbb Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 23 Feb 2025 08:47:17 +0000 Subject: fix memory leak in simulation tests (lol) also, change some vecs into boxed slices, and add RelativeEntityUpdate::new --- azalea/examples/testbot/commands/debug.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'azalea/examples') diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index 1b3b2d61..9de4d97d 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -172,6 +172,9 @@ pub fn register(commands: &mut CommandDispatcher>) { let source = ctx.source.lock(); source.reply("Ok!"); + + + source.bot.disconnect(); let ecs = source.bot.ecs.clone(); @@ -181,6 +184,8 @@ pub fn register(commands: &mut CommandDispatcher>) { let ecs = ecs.lock(); + + let report_path = env::temp_dir().join("azalea-ecs-leak-report.txt"); let mut report = File::create(&report_path).unwrap(); @@ -203,6 +208,7 @@ pub fn register(commands: &mut CommandDispatcher>) { writeln!(report).unwrap(); + for (info, _) in ecs.iter_resources() { let name = info.name(); writeln!(report, "Resource: {name}").unwrap(); @@ -212,6 +218,7 @@ pub fn register(commands: &mut CommandDispatcher>) { match name { "azalea_world::container::InstanceContainer" => { let instance_container = ecs.resource::(); + for (instance_name, instance) in &instance_container.instances { writeln!(report, "- Name: {}", instance_name).unwrap(); writeln!(report, "- Reference count: {}", instance.strong_count()) -- cgit v1.2.3