Fix for Memory Leak on MeshElement3D

Anonymous 10 years ago 0
This discussion was imported from CodePlex

crashedapp wrote at 2011-10-08 00:13:

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!

objo wrote at 2011-10-08 20:53:

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.