You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error Leaked 1.2 kiB
Info at malloc (vg_replace_malloc.c:307)
at alloc::alloc::alloc (alloc.rs:80)
at hecs::archetype::Archetype::grow (archetype.rs:195)
at hecs::archetype::Archetype::allocate (archetype.rs:159)
at <hecs::world::SpawnBatchIter<I> as core::iter::traits::iterator::Iterator>::next (world.rs:763)
at <&mut I as core::iter::traits::iterator::Iterator>::next (iterator.rs:3283)
at <hecs::world::SpawnBatchIter<I> as core::ops::drop::Drop>::drop (world.rs:748)
at core::ptr::drop_in_place (mod.rs:184)
at tests::spawn_batch_unexact (tests.rs:355)
at tests::spawn_batch_unexact::{{closure}} (tests.rs:340)
at core::ops::function::FnOnce::call_once (function.rs:232)
at call_once<(),FnOnce<()>> (boxed.rs:1076)
at call_once<(),alloc::boxed::Box<FnOnce<()>>> (panic.rs:318)
at do_call<std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>>>,()> (panicking.rs:297)
at try<(),std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>>>> (panicking.rs:274)
at catch_unwind<std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>>>,()> (panic.rs:394)
at run_test_in_process (lib.rs:541)
at test::run_test::run_test_inner::{{closure}} (lib.rs:450)
Error Leaked 2.0 MiB
Info at malloc (vg_replace_malloc.c:307)
at alloc::alloc::alloc (alloc.rs:80)
at hecs::archetype::Archetype::grow (archetype.rs:195)
at hecs::archetype::Archetype::allocate (archetype.rs:159)
at hecs::world::World::spawn (world.rs:98)
at tests::spawn_many (tests.rs:248)
at tests::spawn_many::{{closure}} (tests.rs:244)
at core::ops::function::FnOnce::call_once (function.rs:232)
at call_once<(),FnOnce<()>> (boxed.rs:1076)
at call_once<(),alloc::boxed::Box<FnOnce<()>>> (panic.rs:318)
at do_call<std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>>>,()> (panicking.rs:297)
at try<(),std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>>>> (panicking.rs:274)
at catch_unwind<std::panic::AssertUnwindSafe<alloc::boxed::Box<FnOnce<()>>>,()> (panic.rs:394)
at run_test_in_process (lib.rs:541)
at test::run_test::run_test_inner::{{closure}} (lib.rs:450)
at std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:130)
at {{closure}}<closure-0,()> (mod.rs:475)
at call_once<(),closure-0> (panic.rs:318)
at do_call<std::panic::AssertUnwindSafe<closure-0>,()> (panicking.rs:297)
at try<(),std::panic::AssertUnwindSafe<closure-0>> (panicking.rs:274)
at catch_unwind<std::panic::AssertUnwindSafe<closure-0>,()> (panic.rs:394)
at {{closure}}<closure-0,()> (mod.rs:474)
at core::ops::function::FnOnce::call_once{{vtable-shim}} (function.rs:232)
at call_once<(),FnOnce<()>> (boxed.rs:1076)
at call_once<(),alloc::boxed::Box<FnOnce<()>>> (boxed.rs:1076)
at std::sys::unix::thread::Thread::new::thread_start (thread.rs:87)
Summary Leaked 2.0 MiB total
Note that valgrind also reported leaked memory for spawn_many, which is ignored for miri, but it seems likely that both leaks may have the same underlying reason.
The text was updated successfully, but these errors were encountered:
Well, seems like this has a simple cause: the old allocation isn't freed in Archetype::grow! self.data = UnsafeCell::new(new_data); merely dropped the pointer, the allocation isn't freed.
ghost
changed the title
spawn_batch leaks memory when called with an iterator that does not have an exact size_hint
Archetype::grow leaks previously allocated memory
Sep 23, 2020
With this test case on
master
:miri reports:
cargo-valgrind
reports:Note that valgrind also reported leaked memory for
spawn_many
, which is ignored for miri, but it seems likely that both leaks may have the same underlying reason.The text was updated successfully, but these errors were encountered: