Bug 23514 - Out Of Memory exception in Xamarin.Forms - Android
Summary: Out Of Memory exception in Xamarin.Forms - Android
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-10-01 03:32 UTC by Femil Shajin
Modified: 2016-03-18 08:16 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Femil Shajin 2014-10-01 03:32:43 UTC
The application which I have developed is an survey application. The Navigation of my application is similar to this Page1 --> Page2 --> Page3 --> Page4 --> Page1. While navigating from one page to another it occupies heap space every time which leads to OOM exception.

I have tried

-GC.Collect() in OnDisappearing() in every page, It didn't help

-Used override OnLowMemory() in MainActivity.

public override void OnLowMemory() 
  GC.Collect ();
-Deleted High res images.

I have used bitmap for button renderer that too within the using block, other than this I haven't used bitmap anywhere else.

In application output I can see that the heap space constantly grows while revisiting the page every time.

I'm using Xamarin.Forms 1.2.3-pre4
Comment 1 Seth Rosetter 2014-10-01 13:26:16 UTC
Hi Femil,

Would you mind posting a sample of your code / project so that we can investigate?

Comment 2 Femil Shajin 2014-10-08 05:20:22 UTC

Please find the sample code in github link given below.


Please run in emulator by selecting icons and continue the loop of navigation.
Comment 3 Parmendra Kumar 2014-11-05 07:15:52 UTC
Hi Femil,
I have checked this issue with attached sample in comment #2, After click to icon and next we are getting Exception "Object reference not set to an instance of an object".
Please check the Screencast and let me know if I am missing anything.
Please see the Output Log and let me know if you getting same.
Output Log: https://gist.github.com/Rajneesh360Logica/29ced31ec07def992ae1
ZipXamLog: https://gist.github.com/Rajneesh360Logica/5abbbcf79e3d6c339817

Environment Info:
Microsoft Visual Studio Professional 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Version 4.5.50938

Comment 4 Jason Smith [MSFT] 2016-03-18 08:16:30 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we no longer believe it affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team