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.