xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] PopAsync does not release memory of popped page #10274

Open poliahrameshkumar opened 4 years ago

poliahrameshkumar commented 4 years ago

Description

When we use PopAsync in Xamarin.Forms, the memory of popped page is not getting released. This was observed on iOS based on Xamarin.Profiler and app performance.

Steps to Reproduce

  1. Make use of PopAsync
  2. Observe if the memory is getting released or not

Expected Behavior

Memory should get released

Actual Behavior

Memory is not getting released

Basic Information

Screenshots

Reproduction Link

Workaround

No workaround is found so far.

samhouts commented 4 years ago

@poliahrameshkumar Can you please attach a small project that demonstrates this issue? Thanks!

poliahrameshkumar commented 4 years ago

@samhouts you can create a two page application and put some large image file in second page. You can try to pop the second page to go to first page. It will not release the memory of the second page. You can create this simple project and check.

PureWeen commented 4 years ago

@poliahrameshkumar can you post some screen shots of the objects you see leaking?

I think this static array is leaking https://github.com/xamarin/Xamarin.Forms/blob/7a9b54dae9605169f0417c168af2cd81f931b2a9/Xamarin.Forms.Core/Layout.cs#L62

But I'd still like to see what you see so we can see if it's what we're all seeing

poliahrameshkumar commented 4 years ago

@PureWeen Sorry to say, my Xamarin.Profiler got expired after one month. So, now I can't check. If someone with access to profiler checks this, it would be helpful.

PureWeen commented 4 years ago

@poliahrameshkumar were you testing with a brand new app? or your own app?

Do you have a repro of the app you were testing with we can check?

poliahrameshkumar commented 4 years ago

@PureWeen My own app. But in every app It will be reproducible.

PureWeen commented 4 years ago

It's going to possibly vary app to app and in some apps it's the users fault

We can look into what I found but there's a chance it's not what you found.

poliahrameshkumar commented 4 years ago

My issue is related to this issue https://github.com/xamarin/Xamarin.Forms/issues/1429

sanyandreichuk commented 3 years ago

Any news on this issue? Please see the repro project below https://www.dropbox.com/s/991aw7u7667skgg/MemoryTest.zip?dl=0

Steps to reproduce (please use an actual device, not a simulator) :

  1. Run the app.
  2. Click the 'Next' button.
  3. Click the 'Back' button.
  4. Repeat steps 2-3 till the app crashes.
Ranger-Rick commented 3 years ago

Just discovered this memory leak in my app as well. Is there any update on this issue? Or any known workarounds?

nyanoSumitem commented 1 year ago

I'm currently having the same issue with my app. It's been over a year since the last post, any progress? Or is there a workaround?