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

Serious MAUI (ClientApp) memory leak problem #447

Open
DarrenStasiak opened this issue Jul 10, 2024 · 3 comments
Open

Serious MAUI (ClientApp) memory leak problem #447

DarrenStasiak opened this issue Jul 10, 2024 · 3 comments
Assignees

Comments

@DarrenStasiak
Copy link

In recent days our company discovered serious memory leak in MAUI app we are working on i.e. views set as transient don't get disposed of correctly resulting in linear memory growth. Firstly we tried using MAUI wiki page on memory leaks, which yield no concrete results to our problem. Our team decided look up how it is done in eShop demo, and we found same leak here.

In demo we added GC.Collect, destructors to each view (on which we put a breakpoints) and label (under "Adventure Works'" title) that displays current heap size.

Examples below:

Cheap size on startup:

Pasted image 20240710125722

Cheap size after opening and closing BasketView 10 times

Pasted image 20240710125812

On opening and closing BasketView breakpoints weren't triggered single time and heap size kept increasing.

After deleting command from button in BasketView destructor started working.

Pasted image 20240710140645
Pasted image 20240710130458

Questions

Why does it happen, is there some explanation to why MAUI behaves this way?
If it is not problem with MAUI, then where lays that issue?
Do we need to use some practices that aren't shown in this demo?

@jamesmontemagno
Copy link
Member

Let me ping @jonathanpeppers to see if this with the app or is this with .NET MAUI itself somewhere

@jonathanpeppers
Copy link
Member

@DarrenStasiak can you try the latest service release?

The past few releases have fixed various memory issues. dotnet/eShop/main already has dependabot updates for this one.

The next question I have, what does {Binding CheckoutCommand} bind to?

It seems like the issue could be similar to:

Do you have a custom ICommand where CanExecuteChanged is not backed by a "weak event"?

@jamesmontemagno
Copy link
Member

I just updated the packages to 8.0.70 so should be a quick pull to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants