Skip to content

Commit

Permalink
add a test for the TLS memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Apr 25, 2024
1 parent d47e463 commit 95057c4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/many-seeds/tls-leak.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/123583>.
use std::thread;

pub(crate) fn with_thread_local() {
thread_local! { static X: Box<u8> = Box::new(0); }
X.with(|_x| {})
}

fn main() {
let j2 = thread::spawn(with_thread_local);
with_thread_local();
j2.join().unwrap();
}

0 comments on commit 95057c4

Please sign in to comment.