From ea9cff254f2e363a30fcd6f887347f05a76a0f70 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 23 Apr 2024 08:43:06 +0200 Subject: [PATCH] add a test for the TLS memory leak --- src/tools/miri/tests/many-seeds/tls-leak.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/tools/miri/tests/many-seeds/tls-leak.rs diff --git a/src/tools/miri/tests/many-seeds/tls-leak.rs b/src/tools/miri/tests/many-seeds/tls-leak.rs new file mode 100644 index 00000000000..70a506958d1 --- /dev/null +++ b/src/tools/miri/tests/many-seeds/tls-leak.rs @@ -0,0 +1,13 @@ +//! Regression test for . +use std::thread; + +pub(crate) fn with_thread_local() { + thread_local! { static X: Box = Box::new(0); } + X.with(|_x| {}) +} + +fn main() { + let j2 = thread::spawn(with_thread_local); + with_thread_local(); + j2.join().unwrap(); +}