The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

Behavior not being detached cause memory leeks RRS feed

  • Question

  • Hi there, I've seen a bunch of post on this problem, but didn't see any absolutely suitable solution.

    The Detach method is never called even when you navigate away from page, clearing forward stack for frame. This is a real problem as, let's say, there's an ItemsControl referencing quite a collection of elements, which isn't cleared and the references stay strong. I'm trying for now on navigating away retrieving all possible BehaviorCollections and manually call Detach on them, but I consider this as a terrible workaround.

    Are there any suggestions how to deal with this problem? Detaching on AssociatedObject unload isn't going well as the element may load again, but behavior won't be attached then.

    Thursday, May 21, 2015 8:30 AM

All replies