Skip to content

Memory leak in RadioButton ControlTemplate #23199

@krdmllr

Description

@krdmllr

Description

Hi,
we found that when refreshing a list which contains customized RadioButtons, hundreds of Ellipse objects from the template remain in memory.
I created a sample repo which just uses the control template from the maui documentation https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/radiobutton?view=net-maui-8.0#redefine-radiobutton-appearance

When refreshing the list a few times, doing GC.Collects in between and taking a snapshot just using Visual Studio, I found the same issue occuring in the sample repo:
image

Same behavior happens with a Release build + JetBrains dotMemory in our production app.

Steps to Reproduce

  1. Start app
  2. Click "Recreate List" button, this does a GC.Collect(), clears and fills the list again

Link to public reproduction project repository

https://github.com/krdmllr/MauiMemoryLeaks

Version with bug

8.0.60 SR6

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

windows 10.0.19041.0

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

area-controls-radiobuttonRadioButton, RadioButtonGroupp/2Work that is important, but is currently not scheduled for releaseperf/memory-leak 💦Memory usage grows / objects live forever (sub: perf)platform/windowss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions