Pages retained in memory when using DynamicResource Grid style #15986
Labels
area-xaml
XAML, CSS, Triggers, Behaviors
fixed-in-8.0.0-preview.7.8842
Look for this fix in 8.0.0-preview.7.8842!
platform/windows 🪟
t/bug
Something isn't working
t/perf
The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Milestone
Description
In a .NET MAUI Shell app running on Windows it looks like pages referencing DynamicResource Grid styles are held in memory after navigating to and then away from the page. This results in an increase in memory over time as pages are opened and closed.
Steps to Reproduce
Setup
Styles.xaml
:StyledPage
andUnstyledPage
Grid
element to both of the newly created pages4a. To the
StyledPage
add:UnstyledPage
add:MainPage
with a clicked eventawait Navigation.PushAsync(new StyledPage());
MainPage
with a clicked eventawait Navigation.PushAsync(new UnstyledPage());
MainPage
with a clicked eventGC.Collect();
Testing
StyledPage
GC Collect
buttonUnstyledPage
GC Collect
buttonResult: Looking at the memory usage snapshots the number of instances of
StyledPage
in memory increases with the number of times the page has been opened.Expected: The page should no longer exist in memory after navigating away, the number of instances in memory should not increase as the page is repeatedly opened. This works correctly for the
UnstyledPage
.Link to public reproduction project repository
https://github.com/duffh/MauiStylesMemoryLeakTestApp
Version with bug
8.0.0-preview.5.8529
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Windows SDK 10.0.19041.0
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: