-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Context: https://github.com/Vroomer/MAUI-master-detail-memory-leak Context: #12039 Using the Visual Studio's `.NET Object Allocation Tracking` profiler on the sample above I noticed after app launch: Microsoft.Maui.WeakEventManager+Subscription Allocations: 686,114 Bytes: 21,955,648 After spitting out my coffee, I drilled in a bit to see where these are being created: System.Collections.Generic.ObjectEqualityComparer<Microsoft.Maui.WeakEventManager+Subscription>.IndexOf It turns out this `struct` doesn't implement `IEquatable<T>`: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 To solve this: * `Subscription` is private, so we can make it a `readonly struct`. * `dotnet_diagnostic.CA1815.severity = error` across the entire repo. * Implement `IEquatable<T>` for all `struct` types. After these changes, I can't find `Microsoft.Maui.WeakEventManager+Subscription` in the memory report at all. Which assuming means, I saved ~21 MB of allocations in this app. Note that this doesn't actually solve #12039, as I'm still investigating the leak. Maybe this partially closes the floodgate? * Fix `struct`s in Controls.Core Note that I did not update these, as they are some "internal" parts from Xamarin.Forms: * `Profile` * `Datum` We might actually just consider removing these in the future. * Suppress warnings in Compatibility I assume these structs aren't nearly as important, so ignoring a few. They appear to be called once at startup in most cases. * Disable `CA1815` in tests.
- Loading branch information
1 parent
50602da
commit 505b93a
Showing
43 changed files
with
363 additions
and
10 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
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
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
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
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
15 changes: 15 additions & 0 deletions
15
src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt
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
Oops, something went wrong.