Bryant Likes

I was just wondering if calling children.remove actually removes the xaml from the control or if it is doing something else. The reason is that if I have a control and I add and remove lots of xaml it seems that after some time it causes IE some issues (for instance, it takes awhile to close the browser or navigate away). So it made me wonder if remove items actually removes them or if they are still left in some way.

Thanks.



Re: Silverlight (formerly WPF/E) General Discussion Children.remove Performance

KIRANKU

Thank you for sharing your issue, I will be more then happy to help you out. Before I give any recommendationsí» can you share few information with me...

How is the XAML tree created which you are adding and removing from the control is it also created repeatedly for each Add






Re: Silverlight (formerly WPF/E) General Discussion Children.remove Performance

Bryant Likes

I create the xaml tree using javascript. It is created for each add. I've posted an example of it here:

http://blogs.sqlxml.org/wpfe/matrix2/

The javascript is at: http://blogs.sqlxml.org/wpfe/matrix2/matrix.js

Xaml at: http://blogs.sqlxml.org/wpfe/matrix2/matrix.xaml

After each column of letters completes their animation I remove them from the main canvas, but if you let it run for awhile it seems to begin to eat up resources.





Re: Silverlight (formerly WPF/E) General Discussion Children.remove Performance

KIRANKU

Looks like you are repeatedly creating XAML tree (From CreateFromXAML) and adding it using Add/Remove. Each time you create a XAML tree from CreateFromXAML you are keeping the tree alive in the reference stored in Jscript object representing the tree. When you add that tree to the control you just increased the refcount on the Tree. When you remove the Tree from the control you just reduced the refcount but the actual tree is still in the memory held by the JavaScript object. Unfortunately, all the Jscript objects are cleaned up by the browser when that session ends or during garbage collection.

Can you re-use the tree you created






Re: Silverlight (formerly WPF/E) General Discussion Children.remove Performance

Bryant Likes

I'll try. :)

Thanks!