Skip to content

Commit 4864a04

Browse files
authored
Rollup merge of #104401 - RalfJung:mpsc-leak, r=Amanieu
avoid memory leak in mpsc test r? ```@Amanieu```
2 parents 3a8cacd + 5fd561d commit 4864a04

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/std/src/sync/mpsc/tests.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -713,10 +713,11 @@ fn issue_39364() {
713713
let t = thread::spawn(move || {
714714
thread::sleep(Duration::from_millis(300));
715715
let _ = tx.clone();
716-
crate::mem::forget(tx);
716+
// Don't drop; hand back to caller.
717+
tx
717718
});
718719

719720
let _ = rx.recv_timeout(Duration::from_millis(500));
720-
t.join().unwrap();
721+
let _tx = t.join().unwrap(); // delay dropping until end of test
721722
let _ = rx.recv_timeout(Duration::from_millis(500));
722723
}

0 commit comments

Comments
 (0)