Skip to content

Unmanaged Memory Leak: CollectionView not releasing native handlers after page navigation and dynamic disposal in .NET MAUI #32403

@MuthukumarMadasamy

Description

@MuthukumarMadasamy

Description

When using CollectionView in .NET MAUI, unmanaged memory usage grows progressively and is not released even after the control is removed from the visual tree or the page is navigated away. This issue occurs in two scenarios:

Page Navigation: Repeatedly navigating to a page containing a CollectionView and then popping back causes unmanaged memory to increase with each iteration.
Same-Page Dynamic Disposal: Dynamically creating and removing a CollectionView on the same page also results in unmanaged memory retention.

Native platform handlers and views remain allocated even after the CollectionView is removed, indicating incomplete disposal of unmanaged resources. Over time, this leads to memory pressure and potential application crashes in long-running apps.

CollectionView.zip

Sample.zip

Without GC:
Image
Image
Image
Image

With GC:
Triggering garbage collection may slightly reduce unmanaged memory usage temporarily. However, the memory usage begins to increase again over time, indicating that native resources are not being fully released.
Image

Image

Steps to Reproduce

  • Run attached sample.
  • Open the dot memory and open this application.
  • The Click Go to Page.
  • Click Add CollectionView and then Click Remove CollectionView for 20 to 30 times.
  • Then navigate back to main page and take snapshot in dot memory.

Link to public reproduction project repository

No response

Version with bug

9.0.110 SR12

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

No response

Did you find any workaround?

No.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    s/needs-attentionIssue has more information and needs another looks/no-reproCan no longer be reproduced on latests/triagedIssue has been reviewedt/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions