Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Port CollectionView performance fixes from .NET MAUI #15697

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Port CollectionView performance fixes from .NET MAUI dotnet/maui#13327 from Peppers.

The types of leaks this fixes:

  • Bindings to application-lifetime, singleton ViewModels
  • Scrolling CollectionView, ListView, etc. with data-bindings.
  • Styles that were used on a View or Page that is now removed from the screen via navigation, de-parenting, etc.

API Changes

None

Platforms Affected

  • Core/XAML (all platforms)

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@@ -240,7 +240,7 @@ public static void SetInheritedBindingContext(BindableObject bindable, object va
}
else
{
bindable._inheritedContext = value;
bindable._inheritedContext = new WeakReference(value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a UNO instead of creating a new WeakReference instance, you can use code like this to reduce GC pressure:

Suggested change
bindable._inheritedContext = new WeakReference(value);
bindable._inheritedContext ??= new WeakReference(null);
bindable._inheritedContext.Target = value;

@jfversluis
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis jfversluis merged commit 6ad7cd1 into 5.0.0 Feb 28, 2023
@jfversluis jfversluis deleted the port-cv-perf-changes branch February 28, 2023 15:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants