CalculatedProperties icon indicating copy to clipboard operation
CalculatedProperties copied to clipboard

Memory leak: long living source property and short living target property

Open DunetsNM opened this issue 8 years ago • 2 comments

Short living dependency can't be garbage collected when depends on long living source, much like in classic events. Created a pull request with a test and suggested fix.

DunetsNM avatar Jun 28 '17 13:06 DunetsNM

I'll have to look this over pretty closely. In my experience, code that introduces a WeakReference fix often ends up exchanging one bug for another.

StephenCleary avatar Jun 29 '17 00:06 StephenCleary

Do you think it's worth to implement IDisposable instead?

  • CalculatedProperty can remove itself from every source's _targets list
  • PropertyHelper disposes all properties that implement IDisposable

Also, is this project superseded by https://github.com/StephenCleary/Mvvm.CalculatedProperties ?

DunetsNM avatar Aug 07 '18 10:08 DunetsNM