Skip to content

Valgrind reports memory leak upon exit #55

@alekratz

Description

@alekratz

I am using cargo-valgrind to get these results. I have created a brand new project using shreder = "0.1.2", and I am using this main function:

fn main() {
    shredder::run_with_gc_cleanup(|| { });
}

When I run cargo valgrind, this is what I see:

       Error Leaked 288 B
        Info at calloc (vg_replace_malloc.c:760)
             at _dl_allocate_tls
             at pthread_create@@GLIBC_2.2.5
             at std::sys::unix::thread::Thread::new (thread.rs:66)
             at std::thread::Builder::spawn_unchecked (mod.rs:475)
             at std::thread::Builder::spawn (mod.rs:373)
             at std::thread::spawn (mod.rs:596)
             at shredder::collector::dropper::BackgroundDropper::new (dropper.rs:24)
             at shredder::collector::Collector::new (mod.rs:173)
             at core::ops::function::FnOnce::call_once (function.rs:227)
             at once_cell::sync::Lazy<T,F>::force::{{closure}} (lib.rs:953)
             at once_cell::sync::OnceCell<T>::get_or_init::{{closure}} (lib.rs:786)
       Error Leaked 288 B
        Info at calloc (vg_replace_malloc.c:760)
             at _dl_allocate_tls
             at pthread_create@@GLIBC_2.2.5
             at std::sys::unix::thread::Thread::new (thread.rs:66)
             at std::thread::Builder::spawn_unchecked (mod.rs:475)
             at std::thread::Builder::spawn (mod.rs:373)
             at std::thread::spawn (mod.rs:596)
             at shredder::collector::Collector::new (mod.rs:190)
             at core::ops::function::FnOnce::call_once (function.rs:227)
             at once_cell::sync::Lazy<T,F>::force::{{closure}} (lib.rs:953)
             at once_cell::sync::OnceCell<T>::get_or_init::{{closure}} (lib.rs:786)
             at once_cell::imp::OnceCell<T>::initialize::{{closure}} (imp_std.rs:97)
       Error Leaked 3.4 kiB
        Info at calloc (vg_replace_malloc.c:760)
             at _dl_allocate_tls
             at pthread_create@@GLIBC_2.2.5
             at std::sys::unix::thread::Thread::new (thread.rs:66)
             at std::thread::Builder::spawn_unchecked (mod.rs:475)
             at std::thread::Builder::spawn (mod.rs:373)
             at <rayon_core::registry::DefaultSpawn as rayon_core::registry::ThreadSpawn>::spawn (registry.rs:101)
             at rayon_core::registry::Registry::new (registry.rs:260)
             at rayon_core::registry::global_registry::{{closure}} (registry.rs:169)
             at rayon_core::registry::set_global_registry::{{closure}} (registry.rs:195)
             at std::sync::once::Once::call_once::{{closure}} (once.rs:265)
             at std::sync::once::Once::call_inner (once.rs:421)
     Summary Leaked 3.9 kiB total

I would not normally care about this, but it affects my ability to ensure that my programs are not leaking memory.

cargo-valgrind link: https://crates.io/crates/cargo-valgrind

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-enhancementNew feature or requestT-optimizationSomething is slower than it needs to behelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions