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

FluidMoveBehavior memory leak #38

Open
tibel opened this issue Jul 2, 2019 · 9 comments
Open

FluidMoveBehavior memory leak #38

tibel opened this issue Jul 2, 2019 · 9 comments

Comments

@tibel
Copy link

tibel commented Jul 2, 2019

As described in https://social.msdn.microsoft.com/Forums/lync/en-US/f14d1486-24ba-447b-9712-e16f5457a08b/fluidmovebehavior-memory-leak-bug there is a memory leak with the static TagDictionary.

I write this as a reminder/question, as I think this issue is still existing in the current code base.

@brianlagunas
Copy link
Collaborator

Per our issue requirements. A sample must be provided in order for the Behaviors team to evaluate the issue. Please submit an app that can reproduce the issue, and it will be reopened.

@brianlagunas
Copy link
Collaborator

@brianlagunas brianlagunas reopened this Dec 7, 2019
@brianlagunas
Copy link
Collaborator

This is absolutely a memory leak! There is some code that uses a timer to remove objects from the static dictionary to help limit the number of objects in the TagDictionary when the layout updates.

I'm worried about that static TagDictionary. I didn't write this behavior, and I am unaware of it's usage when dealing with many FluidMoveBehaviors. I was first thinking that we could clear the TagDictionary on Detaching or Unloading, but that might impact other FluidMoveBehavior instances in other areas of the app.

@DVaughan @branh do you have any knowledge with this behavior?

@jogibear9988
Copy link

How about using WeakReferences instead of the UI Elements.
And the Timer could remove the entry if one of WeakReferences is invalid

@tibel
Copy link
Author

tibel commented Apr 12, 2020

Might a ConditionalWeakTable work here?

Would be the simplest change:
https://github.com/tibel/XamlBehaviorsWpf/tree/behavior_leak

@BrannonKing
Copy link

@tibel , I like your approach. You should put in a pull request.

@tibel
Copy link
Author

tibel commented Aug 7, 2020

I can create a pull request if the change is accepted as-is (no tests)?

@brianlagunas
Copy link
Collaborator

Hey @tibel was there a specific reason you closed your PR? Did you determine that your approach does not solve the problem?

@tibel
Copy link
Author

tibel commented Apr 14, 2023

I've moved on as I haven't done WPF development in the last few years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants