mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
add a test for the TLS memory leak
This commit is contained in:
parent
f38dba69b1
commit
ea9cff254f
13
src/tools/miri/tests/many-seeds/tls-leak.rs
Normal file
13
src/tools/miri/tests/many-seeds/tls-leak.rs
Normal file
@ -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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user