-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix Memory Leak in ViewViewManager #2658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Memory Leak in ViewViewManager #2658
Conversation
|
|
||
| winrt::com_ptr<ViewPanel> GetViewPanel() | ||
| winrt::com_ptr<ViewPanel> GetViewPanel(bool removeAllChildren = false) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like an odd way to induce removal of the children. Why this instead of just embedding this in removeAllChildren()? Just the logic for getting the container? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to duplicate the logic to check for the control and the border.
But now that you mention it, including a param removeAllChildren on GetViewPanel does seem strange. I'll take another crack at this. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also might work to include more helper functions so you don't duplicate too much logic.
In reply to: 296325388 [](ancestors = 296325388)
randy-flynn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
randy-flynn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
|
Hello @stecrain! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
I found this with windbg and !idallocs provided by the UIExtensions.
Internal to Microsoft you should be able to open windbg, attach to a running React Native Windows App and use the command !idallocs, if it does not get the ui extensions automatically for you, then you probably need to update your debuggers.
Before this fix you could see the number of Windows_UI_Xaml!CPanel objects increasing as you visit more pages.

Using the !xamlTree debugger extensions you can see that some of the panels have no children, and their parent is a border. This made the leak pretty easy to pinpoint.

After this fix I am able to Go back and forth between pages (starting and ending on the same page), and see that the number of Windows_UI_Xaml!CPanel objects in the heap remains constant.

Microsoft Reviewers: Open in CodeFlow