-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
io: fix memory leak during shutdown (#3477)
In some cases, a cycle is created between I/O driver wakers and the I/O driver resource slab. This patch clears stored wakers when an I/O resource is dropped, breaking the cycle. Fixes #3228
- Loading branch information
1 parent
5d35c90
commit 5d0a81f
Showing
8 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,17 @@ authors = ["Tokio Contributors <[email protected]>"] | |
edition = "2018" | ||
publish = false | ||
|
||
[[bin]] | ||
name = "test-cat" | ||
|
||
[[bin]] | ||
name = "test-mem" | ||
required-features = ["rt-net"] | ||
|
||
[features] | ||
# For mem check | ||
rt-net = ["tokio/rt", "tokio/rt-multi-thread", "tokio/net"] | ||
|
||
full = [ | ||
"macros", | ||
"rt", | ||
|
@@ -23,6 +33,4 @@ rt-multi-thread = ["rt", "tokio/rt-multi-thread"] | |
tokio = { path = "../tokio" } | ||
tokio-test = { path = "../tokio-test", optional = true } | ||
doc-comment = "0.3.1" | ||
|
||
[dev-dependencies] | ||
futures = { version = "0.3.0", features = ["async-await"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use futures::future::poll_fn; | ||
|
||
fn main() { | ||
let rt = tokio::runtime::Builder::new_multi_thread() | ||
.worker_threads(1) | ||
.enable_io() | ||
.build() | ||
.unwrap(); | ||
|
||
rt.block_on(async { | ||
let listener = tokio::net::TcpListener::bind("0.0.0.0:0").await.unwrap(); | ||
tokio::spawn(async move { | ||
loop { | ||
poll_fn(|cx| listener.poll_accept(cx)).await.unwrap(); | ||
} | ||
}); | ||
}); | ||
|
||
std::thread::sleep(std::time::Duration::from_millis(50)); | ||
drop(rt); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,12 @@ name = "tokio" | |
# - README.md | ||
# - Update CHANGELOG.md. | ||
# - Create "v1.0.x" git tag. | ||
version = "1.0.2" | ||
version = "1.0.3" | ||
edition = "2018" | ||
authors = ["Tokio Contributors <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
documentation = "https://docs.rs/tokio/1.0.2/tokio/" | ||
documentation = "https://docs.rs/tokio/1.0.3/tokio/" | ||
repository = "https://github.com/tokio-rs/tokio" | ||
homepage = "https://tokio.rs" | ||
description = """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters