Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
In the sample program, ThirdPage contains a webview defined in the xaml. Nothing is done to the webview in the code. Run the program and press the ThirdPage button, then the back arrow, 5 times and look at the memory allocations - there are 5 instances of the ThirdPage, WebView, WebViewRenderer, and WebClient (snapshot1 in the attached file). Not tap the button to garbage collect. The instances of ThirdPage and WebView drops to one, but WebViewRenderer and WebViewClient are still 5 (snapshot2). Why aren't these garbage collected?
Created attachment 21894 [details]
Created attachment 21895 [details]
Created attachment 21911 [details]
Xam support profiler results
Thank you for filing this report!
I believe I'm seeing the issue when I test with the attached project. I tested with an Android 6.0 device and performed the steps below while taking a snapshot in Profiler after each one. I've attached the results from Profiler, one using 2.3.4 and the other using 2.3.5-pre2.
### Profiling steps
1. Launched the app
2. Press "Open Third Page"
3. Go back
4. Press "Open Third Page"
5. Go back
6. Press "Open Third Page"
7. Go back
8. Press "Garbage Collect"
Each time I navigated to the third page, I could see the number of WebView related object allocations increase and most of the allocations persisted even after the page was popped. After running the GC, the number of allocations for these objects did drop to a single instance as mentioned.
In contrast, doing the same steps above on iOS results in a similar object allocation while the page is being pushed/popped, but after the GC is ran the objects are completely collected. So this seems to only be affecting Android.
Migrated to https://github.com/xamarin/Xamarin.Forms/issues/1430
Please follow that issue for future updates.