-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Try fix EventRoute weak memory leak #9463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try fix EventRoute weak memory leak #9463
Conversation
duplicate of dotnet/runtime#9460 |
And I think the #9460 is better than this. This pr is the patch. |
i've closed mine. your fix still has chance of race, when multiple threads are updating the variable. make the variable local? correctness > performance |
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/EventRoute.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/EventRoute.cs
Outdated
Show resolved
Hide resolved
03d93e2
to
b6b976a
Compare
@dipeshmsft You are right. My PR #9463 just simple fix. @h3xds1nz 's #9468 can do more improve. I expected this PR to be incorporated into the official release as a way to fix the patch, so I decided to make minimal changes. |
I completely agree with this. I was thinking of taking this for .NET 9 as this is minimal and solves the problem and will be easier to get approved for servicing. |
@dipeshmsft That was basically "our" intention with @lindexi. |
In that case, @lindexi can you retarget this PR to release/9.0 branch. |
@dipeshmsft Done. |
Thanks a lot @lindexi for taking a stab at this issue. |
Fixes #9467
Reference #6700 and #9460
Description
See #9467
After #6700 , to reduce allocations when tracing routed events, we'll use
_traceArguments
field to store the trace arguments which cause #9467 issues.I try clear the reference from
_traceArguments
after call theTraceRoutedEvent.Trace
.And this pr is a patch, and I think #9460 will be better. Thank you @kasperk81
Customer Impact
See #9467
The memory will still be freed, albeit at a slower pace. Even if this issue is not addressed, it won't have a significant impact. There are two reasons for this. Firstly, the memory will still be freed, it just can't be released immediately. Secondly, this issue only affects those who have enabled Trace, which normal users typically do not do.
Regression
Reference #6700
And Cc @bgrainger
Testing
CI Only.
Risk
Middling
Microsoft Reviewers: Open in CodeFlow