Commit 9ed4077
authored
Fix memory leak in asyncdispatch.withTimeout by clearing losing callbacks (#25567)
withTimeout currently leaves the “losing” callback installed:
- when fut finishes first, timeout callback remains until timer fires,
- when timeout fires first, fut callback remains on the wrapped future.
Under high-throughput use with large future payloads, this retains
closures/future references longer than needed and causes large transient
RSS growth.
This patch clears the opposite callback immediately once outcome is
decided, reducing retention without changing API behavior.1 parent e69d672 commit 9ed4077
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1946 | 1946 | | |
1947 | 1947 | | |
1948 | 1948 | | |
| 1949 | + | |
| 1950 | + | |
1949 | 1951 | | |
1950 | 1952 | | |
1951 | | - | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
1952 | 1957 | | |
1953 | 1958 | | |
1954 | 1959 | | |
| |||
0 commit comments