Skip to content

Valgrind full leak check reports a leak on Rust 1.83.0 #133574

Closed
@sharksforarms

Description

@sharksforarms

Hi all, creating this issue as I noticed our CI failing due to valgrind when updating from 1.82.0 to 1.83.0, the leak seems to be from rust and not from the application (reproducible with default cargo new --bin). Others may also hit this.

Code

# cargo new --bin testvalgrind

$ cat rust-toolchain.toml
[toolchain]
channel = "1.82.0"

$ cargo build && valgrind --leak-check=full target/debug/testvalgrind
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
==1002693== Memcheck, a memory error detector
==1002693== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1002693== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==1002693== Command: target/debug/testvalgrind
==1002693==
Hello, world!
==1002693==
==1002693== HEAP SUMMARY:
==1002693==     in use at exit: 0 bytes in 0 blocks
==1002693==   total heap usage: 10 allocs, 10 frees, 3,184 bytes allocated
==1002693==
==1002693== All heap blocks were freed -- no leaks are possible
==1002693==
==1002693== For lists of detected and suppressed errors, rerun with: -s
==1002693== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

---

$ cat rust-toolchain.toml
[toolchain]
channel = "1.83.0"

$ cargo build && valgrind --leak-check=full target/debug/testvalgrind
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
==1002883== Memcheck, a memory error detector
==1002883== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1002883== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==1002883== Command: target/debug/testvalgrind
==1002883==
Hello, world!
==1002883==
==1002883== HEAP SUMMARY:
==1002883==     in use at exit: 56 bytes in 1 blocks
==1002883==   total heap usage: 9 allocs, 8 frees, 3,152 bytes allocated
==1002883==
==1002883== 56 bytes in 1 blocks are possibly lost in loss record 1 of 1
==1002883==    at 0x4848853: malloc (vg_replace_malloc.c:381)
==1002883==    by 0x1290D0: std::rt::lang_start_internal (alloc.rs:99)
==1002883==    by 0x10EA19: std::rt::lang_start (rt.rs:194)
==1002883==    by 0x10E9DD: main (in /tmp/testvalgrind/target/debug/testvalgrind)
==1002883==
==1002883== LEAK SUMMARY:
==1002883==    definitely lost: 0 bytes in 0 blocks
==1002883==    indirectly lost: 0 bytes in 0 blocks
==1002883==      possibly lost: 56 bytes in 1 blocks
==1002883==    still reachable: 0 bytes in 0 blocks
==1002883==         suppressed: 0 bytes in 0 blocks
==1002883==
==1002883== For lists of detected and suppressed errors, rerun with: -s
==1002883== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

I expected to see this happen: valgrind reports no leak

Instead, this happened: valgrind reports a leak

Version it worked on

It most recently worked on: Rust 1.82.0

Version with regression

rustc --version --verbose:

rustc 1.83.0 (90b35a623 2024-11-26)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions