We have a rather large silverlight 4 application. We are in the process of finding memory leaks in the application and this has turned into a daunting task.
Things have changed completely with this one, for those of you that have seen the original post!
I realised that ANTS memory profiler wasn't showing me the right stuff. That was because the memory leak was not in the managed code, but in the native code. I did fix some issues with ANTS - it is a good tool for managed code memory leaks.
So I found this blog,
http://blogs.msdn.com/b/slperf/archive/2010/08/19/analyzing-silverlight-memory-usage-part-1-obtaining-measurements.aspx
Which was excellent. I used xPerf and xPerfViewer to view the native heap and see what I suspect is the actual memory leak.
So I can see a stack trace which looks like this,
CCoreServices::Draw
CCoreServices::Tick
CUElement::Render
CUIElement::Render
CUIElement::RenderWithTransform
CUIElement::RenderVisual
CUIElement::RenderChildren
{Repeat of the above in a recursive fashion}
So in this 'Render' method somewhere it allocates about 520 bytes of memory, and as far as I can tell it doesn't free it.
I can also see a method or class called
SDBitmapCreate
is leaking memory too.
Interesting because it seems like I have found something, but I am not really sure what.
Any other suggestions?
Thanks.
There's a good tutorial on troubleshooting Silverlight memory leaks here: http://davybrion.com/blog/2009/08/finding-memory-leaks-in-silverlight-with-windbg/. It's complicated, and you have to deal with WinDBG commands, but I've found it helpful in the past. Of course, this doesn't answer your question specifically, but it may point you in the right direction.
First Off, I do not know of any memory leak tools for silverlight.
I experienced what I thought where memory leak problems a few weeks ago. Turns out my Silverlight application had rogue children in the canvas.
My issue may not be your issue, but it may get you thinking.
Before I re-populated my list with results from the server, I had to remove all children from appropriate canvas. Clearing the list wasn't enough.:
for (int i = 0; i < boxDataLabel.Count; i++)
{
canvaz.Children.Remove((Label)boxDataLabel[i]);
}
boxDataLabel.Clear();
boxDataLabel is a list of type Label.
good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With