Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] UWP Memory Leak, Page Navigation, CollectionView, BindablePropertyContext #15588

Open
8m0 opened this issue Oct 28, 2022 · 0 comments
Open
Labels
a/performance p/UWP s/unverified New report that has yet to be verified t/bug 🐛

Comments

@8m0
Copy link

8m0 commented Oct 28, 2022

So, the problem in Xamarin not releasing resources. I've seen same bugs in Issues, and it seems no one care about it, but anyway I decided to submit one myself.

It's just a simple app which has About page and a page with CollectionView.
I clicked back and forth between pages 100 times and the program RAM usage rose from 35.8 mb at start, to 315.8:
firstt

There is a clean all of mock lists / bindings in OnDisappearing Collection page:

protected override void OnDisappearing()
{
    base.OnDisappearing();
    ((CollectionViewModel)BindingContext).Posts.Clear();
    ((CollectionViewModel)BindingContext).Posts = null;
    ((CollectionViewModel)BindingContext).Posts1.Clear();
    ((CollectionViewModel)BindingContext).Posts1 = null;
    ((CollectionViewModel)BindingContext).Posts2.Clear();
    ((CollectionViewModel)BindingContext).Posts2 = null;

    Collection1 = null;
    Collection2 = null;
    Collection3 = null;

    BindingContext = null;
    CollectionPageView = null;
}

There is another button to call Gc.Collect(), i clicked it 100 times as well. It did some progress for a part only at first click:
gccount

Here is screenshot of Debuger window:
debugviewer

Steps to Reproduce

  1. Get project from repository https://github.com/8m0/MemoryLeakApp
  2. Just click button to navigate to Collection page and then go back multiple times.

Expected Behavior

Release resources, don't save unused objects for no reason.

Actual Behavior

Saves thousands of BindablePropertyContext.

Workaround

If there IS any WORKING workaround which I can test and approve for example on my project provided in the post, please let me know.

@8m0 8m0 added s/unverified New report that has yet to be verified t/bug 🐛 labels Oct 28, 2022
@8m0 8m0 changed the title UWP Memory Leak, Page Navigation, CollectionView [BUG] UWP Memory Leak, Page Navigation, CollectionView Oct 28, 2022
@8m0 8m0 changed the title [BUG] UWP Memory Leak, Page Navigation, CollectionView [BUG] UWP Memory Leak, Page Navigation, CollectionView, BindablePropertyContext Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/performance p/UWP s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

3 participants
@jsuarezruiz @8m0 and others