Generic Lists and GCAlloc.Handle

Memory profiling for .NET developers

Generic Lists and GCAlloc.Handle

Postby woodced » Fri Nov 26, 2010 6:25 pm

In my Silverlight application I've got some member properties of Controls that are generic lists. For some reason when the Control is destroyed these are left behind as array structures referenced by a System.Object[] which has been GCHandle.Alloc'ed. Is this behavior correct, or is there something up with my app?[/img]
woodced
 
Posts: 3
Joined: Fri Nov 26, 2010 6:20 pm

Postby AndrewH » Mon Nov 29, 2010 12:44 pm

Static variable storage is implemented internally by .NET as object arrays referenced by GC handles. ANTS usually tries to decode which static variables are actually referencing the objects but can't always successfully resolve the values of all the variables due to the way the profiling API works.

Objects that can be 'interned', such as strings, will also end up in a similar object array, so this pattern doesn't always indicate a static variable.

However, it's most likely that this is what has happened here: there's a static variable somewhere that is referencing your class, but ANTS has been unable to resolve its name.
Andrew Hunter
Software Developer
Red Gate Software Ltd.
AndrewH
 
Posts: 134
Joined: Thu Aug 17, 2006 3:44 pm

Postby woodced » Mon Nov 29, 2010 4:54 pm

Interesting. I can't see why I'd have a static reference to this, but I'd need to look into it further.

Under what circumstances is ANTS not able to decode the static variable reference? Is there any way of avoiding this circumstance?
woodced
 
Posts: 3
Joined: Fri Nov 26, 2010 6:20 pm


Return to ANTS Memory Profiler Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests