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.
When using a NavigationPage with a ContentPage that contains a map on Android and a button to navigate to a new page (of the same layout), navigating back and forth repeatedly will eventually cause an out of memory error.
## Reproduction steps
- Update API key as necessary for Google Play Services
- Run application
- Use the button to navigate forward to a new page, and navigate back as desired
- An out of memory error should eventually occur (testing an S5, it took maybe 25-30 pages or so).
Created attachment 15333 [details]
I have managed to fix the memory leak. I have subclassed the xamarin map renderer and in the Dispose method, instead of calling base.Dispose() I am calling the below (as well as the code in the current MapRenderer.Dispose method)
(this.Control as MapView).OnPause();
(this.Control as MapView).OnDestroy();
(this.Control as MapView).Dispose();
The issue is Xamarin aren't calling these in the dispose, so the view lives on in memory and causes memory leaks. So to fix, these need to be applied in the Dispose method of the MapRenderer at somne point
Do you mind sharing a sample project ? ty
Should be fixed in 2.3.4-pre1
I have checked this issue with Xamarin.Forms 2.3.4-pre1 and I am not getting any crash.
Hence closing this issue.