Will Dependency property binding and Styles cause MEMORYLEAK?
Is there any chance that memory leak can occur by usin开发者_如何学JAVAg Dependency property binding or Styles. It is showing weak reference in Memory profiling tool and if i remove the binding or style weak reference is not there?. Any idea what will be the cause of that memory leak?
Not that I have ever detected. And I've used WPF to build some pretty complex 3D UI's.
Weak References are kept until the system needs to garbage collect the location. It is an optimization issue, not a memory leak. The usage of weak references mean that the coder thinks that an object is nice to have around (i.e. sort of cached), but is also OK not to have around (can reload it). So it is up to the .NET runtime to decide when to reclaim a weak-referenced object.
Quite a few WPF constructs are implemented using weak references (I believe triggers and stuff).
精彩评论