Skip to content
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

Fix Repeater memoization memory leak #1886

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

exyi
Copy link
Member

@exyi exyi commented Nov 19, 2024

If the ConditionalWeakTable references itself, it will get leaked by .NET Core GC: dotnet/runtime#12255

Fortunately, we don't really need the ConditinalWeakTable here:

  • Repeater should generally be a short-lived object, so strong references will also be collected reasonably soon
  • Between Load and PreRender, the viewmodels were pinned in the DataContext of all children and the children are in Children collection. Only after PreRender could those references be useful, but we can as well Clear the dictionary at that point.

@exyi exyi added the bug label Nov 19, 2024
If the ConditionalWeakTable references itself, it will get leaked by
.NET Core GC: dotnet/runtime#12255

Fortunately, we don't really need the ConditinalWeakTable here:
* Repeater should generally be a short-lived object, so
   strong references will also be collected reasonably soon
* Between Load and PreRender, the viewmodels were pinned
   in the DataContext of all children and the children are in Children
   collection. Only after PreRender could those references be useful,
   but we can as well Clear the dictionary at that point.

Co-authored-by: Adam Štěpánek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant