Discussion: Memory leak in NavigationView even though I cleared the child page element while unloading.
See original GitHub issueDiscussion: Why memory leak occurs while displaying a custom code snippets view in a NavigationView’s child page.
Describe the bug
While using the NavigationView
control to navigate child pages, the child page’s elements were cleared in its own unloading methods. But, the child pages retaining their memory after closing them.
Steps to reproduce the bug
- Open and build the sample App8.zip with x86 or x64 architecture.
- To take a memory leak report, click the
Debug
menu item and select thePerformance Profiler
in Visual studio. - Select the
Memory Usage
check box and clickStart
button - Visual studio will start the diagnostic session and launching the application
- Click the
TakeScreenshot
button in the Visual Studio diagnostic session. - Click on the
DemoList
Navigation Menu Item in the application. - Click on the
Code Snippets1
grid view item and its opens a code snippets page - Click on the
Back
app bar button - Repeat steps 7 and 8 for
CodeSnippets 2
andCodeSnippets 3
- Click the
Empty Page
Navigation Menu Item. - Wait for 2 min and click the
Force GC
in the Visual Studio diagnostic session. - Click the
TakeScreenshot
button in the Visual Studio diagnostic session. - Then, click the
Stop Collection
Memory leak report:
Expected behavior
Memory should be the same or low as the initial screenshot.
Version Info
NuGet package version: [WinUI 3 - Windows App SDK 0.8: 0.8.1]
Windows app type
WinRT
Windows version
October 2020 Update (19042)
Related Links
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13
Top Results From Across the Web
SwiftUI - memory leak in NavigationView
Tested with Xcode 11.4 / iOS 13.4 - ViewModel destroyed as expected. Here is complete test module code: struct CloseBarItem: View { //...
Read more >Debug DOM memory leaks with the Detached Elements tool
A memory leak can occur in your application when an element is no longer attached to the Document Object Model (DOM) tree, but...
Read more >2022 Chevrolet Bolt EUV Owner's Manual
Shown when the service manual has additional instructions or information. 0 : Shown when there is more information on another page — “see...
Read more >2022 Chevrolet Corvette Owner's Manual
This manual describes features that may or may not be on the vehicle because of optional equipment that was not purchased on the...
Read more >Memory leaks?
Guys, have you come accross memory leaks when using Ranorex? I noticed that whenever I use ranorex lib, the memory allocated by my...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is this issue not a high priority? “WinUI 3 Gallery” and “PowerToys” also has this problem(WinAppSDK: 1.2).
@vfib memory usage still increase when more than 500 MB, but the growth will slow down. if you continue navigation, your app will crash. (tested with WinAppSDK 1.3)
Powertoys can be used for testing, navigated to difference page many times, Powertoys will crash.
Temporary solutions is: