Fix for Memory Leak on MeshElement3D

Oct 7, 2011 at 10:13 PM

I noticed I was getting a memory leak when removing a control from a page that was using several SphereVisual3D objects.

I was able to find the casue.

In MeshElement3D there is an event wired up to CompositionTarget.Rendering

The event doesn't even appear to be needed so I commented it out.

The memory leak is gone.

Thanks to Ants for their great profiler and thanks to you for your great Project!

Coordinator
Oct 8, 2011 at 6:53 PM

thanks for pointing this out!

I removed the subscription to the CompositionTarget.Rendering event, you are right - it should not be needed.

I also improved the ScreenSpaceLines CompositionTarget.Rendering event wiring - it should now unsubscribe automatically when an element is removed from the visual tree.