Tracking Leaks due to attached DependencyProperty

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Posts: 4
Joined: Fri Jun 04, 2010 2:13 pm

Tracking Leaks due to attached DependencyProperty

Post by pchristm » Wed Jun 16, 2010 5:27 pm

So, through some hunting I found a strategy that worked for me to find leaks to to attached DependencyProperty's on objects. I see the leak (EffectiveValueEntry[] holding onto my object), look up it's index in the EffectiveValueEntry[], and find the _propertyIndex which I can use to lookup the DependencyProperty in the ItemStructList<DependencyProperty>.

This works sometimes. The problem is that the list is usually over a 1000 DPs, and is truncated at 575. I can't find a setting to configure this. Is there any way to change where it truncates? Is there a better way to track down which DependencyProperty is holding my object?

Patrick Christmas

Andreas Suurkuusk
Posts: 1030
Joined: Wed Mar 02, 2005 7:53 pm

Re: Tracking Leaks due to attached DependencyProperty

Post by Andreas Suurkuusk » Thu Jun 17, 2010 9:18 pm

In the current version of .NET Memory Profiler at most 500 references are presented in the Type instance details view. This limit is clearly too low for what you are trying to do. We will improve this in a future version, but in the meantime we have built a maintenance version were the limit has been increased to 2000 references, which might be enough for you.

Another way of getting the DependencyProperty information is to always collect instance data for the DependencyProperty array. The number of fields presented in the Instance fields view is currently not limited. To collect instance data for the DependencyProperty array, add it to the instance data collections rules (as can be seen in the screenshot).
Collect DependencyProperty[]
CollectDepProperty.png (46.66 KiB) Viewed 8307 times
Unfortunately, the data collection rules don't work correctly for array types in the current version. This has also been fixed in the newly built maintenance version, which can be downloaded from: (or ... -64bit.msi for the 64-bit version).

In the next major release of .NET Memory Profiler, dependency properties will be analysed by the profiler and presented as "property fields" in the Type instance detailes view.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests