Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo valgrind always reports "leaked 56 B in 1 block" #111

Open
Altair-Bueno opened this issue Dec 3, 2024 · 2 comments
Open

cargo valgrind always reports "leaked 56 B in 1 block" #111

Altair-Bueno opened this issue Dec 3, 2024 · 2 comments

Comments

@Altair-Bueno
Copy link

Even Hello world! Is it an issue with valgrind or std::rt?

fn main() {
    println!("Hello, world!");
}
$ cargo valgrind run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
     Running `/home/abueno@airzonesl.es/.cargo/bin/cargo-valgrind target/debug/test-valgrind`
Hello, world!
       Error leaked 56 B in 1 block
        Info stack trace (user code at the bottom)
             at malloc
             at alloc (alloc.rs:99)
             at alloc_impl (alloc.rs:192)
             at allocate (alloc.rs:254)
             at {closure#0}<std::thread::Inner> (sync.rs:483)
             at allocate_for_layout<core::mem::maybe_uninit::MaybeUninit<std::thread::Inner>, alloc::sync::{impl#14}::new_uninit::{closure_env#0}<std::thread::Inner>, fn(*mut u8) -> *mut alloc::sync::ArcInner<core::mem::maybe_uninit::MaybeUninit<std::thread::Inner>>> (sync.rs:1925)
             at new_uninit<std::thread::Inner> (sync.rs:481)
             at new_inner (mod.rs:1343)
             at new_main (mod.rs:1333)
             at init (rt.rs:113)
             at {closure#0} (rt.rs:172)
             at do_call<std::rt::lang_start_internal::{closure_env#0}, ()> (panicking.rs:557)
             at try<(), std::rt::lang_start_internal::{closure_env#0}> (panicking.rs:520)
             at catch_unwind<std::rt::lang_start_internal::{closure_env#0}, ()> (panic.rs:358)
             at std::rt::lang_start_internal (rt.rs:172)
             at std::rt::lang_start (rt.rs:194)
             at main
     Summary Leaked 56 B total (0 other errors)
$ rustc --version --verbose
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: x86_64-unknown-linux-gnu
release: 1.83.0
LLVM version: 19.1.1
$ valgrind --version
valgrind-3.22.0
$ cargo install cargo-valgrind
    Updating crates.io index
     Ignored package `cargo-valgrind v2.2.1` is already installed, use --force to override

test-valgrind.zip

@jfrimmel
Copy link
Owner

jfrimmel commented Dec 3, 2024

Hello,
thank you for this well-written report. Indeed, this is caused by the Rust 1.83 standard library, as is discussed here: rust-lang/rust#133574. This tool has currently no way to suppress such "leaks" (especially important, since they are intentional), but this has just being requested in #107.

@Altair-Bueno
Copy link
Author

Thanks for the quick reply. I imagined it had something to do with that issue, but i thought a reproduction and a clear bug description would be valuable both for contributors and users (who are probably going to panic! when CI fails).

@jfrimmel jfrimmel pinned this issue Dec 3, 2024
jfrimmel added a commit that referenced this issue Dec 15, 2024
It can happen, that new compiler versions introduce new behavior to the
Rust standard library, which might impact this tool (see #111 for an ex-
ample of such an issue). Therefore this job builds the code with the
current beta compiler to detect potential issues before they reach the
stable compiler/standard library. The jobs runs once per week and will
create a GitHub issue in case of a failing build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants