Skip to content

Commit 92b0699

Browse files
committed
add a test for the TLS memory leak
1 parent c1b8256 commit 92b0699

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/many-seeds/tls-leak.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/123583>.
2+
use std::thread;
3+
4+
pub(crate) fn with_thread_local() {
5+
thread_local! { static X: Box<u8> = Box::new(0); }
6+
X.with(|_x| {})
7+
}
8+
9+
fn main() {
10+
let j2 = thread::spawn(with_thread_local);
11+
with_thread_local();
12+
j2.join().unwrap();
13+
}

0 commit comments

Comments
 (0)