Yes, according to what you provided, you have a memory leak. When you find a link chain, and this is not in your code, the easiest way would be ... Reflector.
The image says: the JournalEntryKeepAlive._keepAliveRoot field contains a reference to the object. Release Reflector and see how this guy is attached to our object.
This time it was easy, and all traces lead to the NavigationService.MakeJournalEntry() function, and then to the NavigationService.IsContentKeepAlive() . Here he is:
internal bool IsContentKeepAlive() { bool keepAlive = true; DependencyObject dependencyObject = this._bp as DependencyObject; if (dependencyObject != null) { keepAlive = JournalEntry.GetKeepAlive(dependencyObject); if (!keepAlive) { PageFunctionBase base2 = dependencyObject as PageFunctionBase; bool flag2 = !this.CanReloadFromUri; if ((base2 == null) && flag2) { keepAlive = true; } } } return keepAlive; }
Now you know the rules. An object is stored in memory if:
- It is not an object of dependence;
- The attached JournalEntry.KeepAlive property is true;
- This is not a PageFunction, and it cannot be reloaded from Uri.
After this study, it might be worth reading more about the JournalEntry.KeepAlive property on MSDN.
This strategy helped me find many insects related to memory. Hope this helps you too :).
PS: If you have a problem finding this particular leak, you can insert a minimal sample code so that we can reproduce it and give you a more correct answer.
Cheers, Anvaka
Anvaka
source share