Hi,

Firstly, I'd just like to say I'm really impressed with Memory Profiler 5. The Object Retention Graph is pretty much exactly what I was wishing someone had about 2 days before your announcement of the RC.

I'm currently working on a moderate sized app based on Prism (Composite Application Guidance for WPF if you prefer :) ), where we made a pretty bad mistake subscribing to events on long running services from short-lived views all over the place. I'm trying to unpick the mess we made in one bit of the UI before getting everyone to pitch in and fix the whole app.

I've now managed to get rid of all the strong event subscriptions in the area of the UI I'm looking at, but my class instances still aren't being GC'ed, and I'm now finding the ORG confusing. All the paths to GC roots look like things that shouldn't hold a WPF view live (e.g. data-binding internals that should be based on weak references & metadata).

I think what's happening is that it's showing me the shortest path to a particular gcroot, and that's hiding a more interesting path.

Here's an example:
http://cid-103d3b00893db5df.skydrive.live.com/self.aspx/TempPublic/ProjectOverviewPresentationModel-Before.pdf

Here's the same thing after I removed use of Localization.Attributes on the DataTreeView and its HeirarchicalDataTemplate:
http://cid-103d3b00893db5df.skydrive.live.com/self.aspx/TempPublic/ProjectOverviewPresentationModel-After.pdf

What would be nice would be a way to exclude a particular path from the ORG.

Does anyone know any other workaround?

Cheers,

James
swythan
0

Comments

4 comments

  • Andrew H
    We do only show the shortest paths in the object reference graph at the moment: we're planning to look at new ways of exploring the graph in future versions. However, the roots that we do show are only the strong roots for an object: weak roots (and hence weak references) are deliberately excluded from the graph, as there are usually too many of these in WinForms or WPF applications for the graph to make any sense.

    You can use the class reference graph to explore the full relationships between objects, and switch to the object list or graph when you find something interesting there. The filters can be useful for narrowing down cases where there are a lot of similar objects. For a UI library like WPF you typically find that everything eventually references everything else in some way - it's for this reason that we prefer to use the shortest path, as when there's a loop of references, the objects nearer to a root are typically nearer to the 'start' of the loop as seen from the point of view of the program.

    The object graph highlights any objects that make a loop in a blue box - any objects so highlighted have a path linking them in both directions - typically through parent/child fields but sometimes via more complicated paths.
    Andrew H
    0
  • swythan
    Thanks for the info.

    I've now discovered the cause of my confusing results, in case it helps anyone.

    Localization._attributesOnObjects is the storage used when the Localization.Attributes attached property is set on an object that isn't a DependencyObject. In our case we were setting it on some DataTemplates and HeirarchicalDataTemplates to stop our L18n tool's automatic simulated translation messing them up. That turns out to have been a bad idea.

    System.ComponentModel.ReflectPropertyDescriptor turned out to be a signpost to a genuine WPF memory leak, as described here: http://support.microsoft.com/kb/938416

    In our case we're doing View-PresentationModel (similar/same as MVVM) and some of our PMs weren't implementing INotifyPropertyChanged. As the View & the PM reference each other, that was triggering the leak. Implementing INotifyPropertyChanged or setting the Mode of the view's bindings to the PM to OneTime fixes the leak.

    Many, many thanks again for v5. I can't imagine how I would have tracked all this down without it.

    Is there any way of extending the trial of the RC? Mine's about to run out, but we've got 10 full ANTS ".Net Bundle" licences (with 1 year's worth of free upgrades) that we bought in Dec/Jan.
    swythan
    0
  • StephenC
    Hi James,

    Very glad that you found the cause of the problem and that the new version has proved such a success for you.

    The final V5.0 release is due out tomorrow so you will be able to download and use it from then on as the activation/licensing will work with your key etc...

    Regards,

    Stephen
    StephenC
    0
  • swythan
    Brilliant! I swear you guys are reading my mind! :D
    swythan
    0

Add comment

Please sign in to leave a comment.