diff options
| author | mat <git@matdoes.dev> | 2025-02-23 08:47:17 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-23 08:47:17 +0000 |
| commit | dd557c8f293dbef3e2e881bcb1a85a7697a1ebbb (patch) | |
| tree | 9878084875ac8ca7259db26b2c16776f212802a3 /azalea | |
| parent | e21e1b97bf9337e9f4747cd1b545b1b3a03e2ce7 (diff) | |
| download | azalea-drasl-dd557c8f293dbef3e2e881bcb1a85a7697a1ebbb.tar.xz | |
fix memory leak in simulation tests (lol)
also, change some vecs into boxed slices, and add RelativeEntityUpdate::new
Diffstat (limited to 'azalea')
| -rw-r--r-- | azalea/examples/testbot/commands/debug.rs | 7 |
1 files changed, 7 insertions, 0 deletions
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<Mutex<CommandSource>>) { 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<Mutex<CommandSource>>) { 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<Mutex<CommandSource>>) { 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<Mutex<CommandSource>>) { match name { "azalea_world::container::InstanceContainer" => { let instance_container = ecs.resource::<InstanceContainer>(); + for (instance_name, instance) in &instance_container.instances { writeln!(report, "- Name: {}", instance_name).unwrap(); writeln!(report, "- Reference count: {}", instance.strong_count()) |
