Skip to content

WinUI 3 Page objects are being leaked on navigate in a C#/WinRT app #413

@llongley

Description

@llongley

I've put together two sample apps to demonstrate the same scenario, one in C++/WinRT, the other in C#/WinRT:

C++/WinRT: DesktopWinUICppLeakTest.zip

C#/WinRT: DesktopWinUICSharpLeakTest.zip

In both cases, the app contains a ListView containing 1,000 items, plus a button that navigates to and from a second page also containing a ListView with 1,000 items. In the C++/WinRT case, the memory footprint of the app stays the same after successive navigations, whereas in the C#/WinRT case, the memory footprint steadily grows. A heap dump analysis indicates that the root Page object in native code is what's leaking, so it's likely the case that something in the C#/WinRT projection is holding onto the native object past when it should be.

Metadata

Metadata

Labels

bugSomething isn't workingfixedIssue has been fixed in an upcoming or existing releasegcRelated to garbage collectionpri-0Blocking/issue has no workaround

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions