Hi Nigel, I spent a few minutes looking at ChangeWatcher. It looks correct to me. I added more details in a comment to FLEX-27837.
On 9/22/13 5:47 AM, "Nigel Magnay" <[email protected]> wrote: >Whilst diagnosing our application's memory leaks, I found that we have >places that use ChangeWatcher like this: > >var cw1:ChangeWatcher = ChangeWatcher.watch(allocation, ["task", "phase", >"status"],statusChange, false, true); > > >The use of 'true' implying 'weak references' - to not hold a strong >reference to statusChange. > >However- because the ChangeWatcher chain has multiple values, this is >ignored for the latter parts of the list: > >I.E: The source is this: > > >public static function watch(host:Object, chain:Object, > > handler:Function, > > commitOnly:Boolean = false, > > useWeakReference:Boolean = >false):ChangeWatcher > > { > > if (!(chain is Array)) > > chain = [ chain ]; > > if (chain.length > 0) > > { > > var w:ChangeWatcher = > > new ChangeWatcher(chain[0], handler, commitOnly, > > watch(null, chain.slice(1), handler, commitOnly)); > > w.useWeakReference = useWeakReference; > > w.reset(host); > > return w; > > } > > else > > { > > return null; > > } > > } > > >But the Constructor line *should* be: > > var w:ChangeWatcher = > > new ChangeWatcher(chain[0], handler, commitOnly, > > watch(null, chain.slice(1), handler, commitOnly >, >*useWeakReference* >)); > > >This seems to be the same issue as reported in FLEX-27837, which was >created over 2 years ago - marked as Major and 'easyfix'. > >Is there a reason it hasn't been fixed (I.E: its behaviour is believed to >be correct) ? The way it is currently is really unexpected, and leaks >memory horribly - I can't believe we're the only users seeing this..
