Bug 33185 - XF leaks memory when navigating between pages
Summary: XF leaks memory when navigating between pages
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.4
Hardware: PC Mac OS
: High critical
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2015-08-18 06:02 UTC by Prashant Cholachagudda
Modified: 2016-08-04 21:37 UTC (History)
15 users (show)

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

Test case. (1.25 MB, application/zip)
2015-08-18 06:02 UTC, Prashant Cholachagudda

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 Prashant Cholachagudda 2015-08-18 06:02:11 UTC
Created attachment 12545 [details]
Test case.

XF forms leaks memory every time we navigate to a page and back leaks memory.

# Steps to reproduce

1. Run the attached test case
2. On Page 1 - tap Forward - and get to the Page 2.
3. On Page 2 - tap Backward and get to the Page 1.

If you do it number of times, you'll see that memory allocated to the app is increasing (~2K per roundtrip Page1-Page2-Page1).
Comment 1 Parmendra Kumar 2015-08-20 10:38:02 UTC

I tried to reproduce this issue and I am not sure how to confirm that memory allocated to the app is increasing (~2k).I have attached ApplicationOut and Screencast.

Could you please see the screencast and Applicationoutput and let me know If I have missed anything to checked this issue.

Screencast: http://www.screencast.com/t/jsWlFiW650h3

ApplicationOutput: https://gist.github.com/Parmendrak/cb4a3994b394662c0f3b
SystemLog: https://gist.github.com/Parmendrak/c1570d773d0331d92015

Environment info:
Xamarin Studio 5.9.5 (build 10)
Mono 4.0.3 ((detached/d6946b4)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400030020
Xcode 6.2 (6776)
Xamarin.iOS : (Enterprise Edition)
Xamarin.Android : (Enterprise Edition)
Mac OS X 10.9.4
Comment 2 Prashant Cholachagudda 2015-08-31 01:15:29 UTC
@pramedra, you can check the memory information displayed on the page.
The number increases every time you navigate between pages.
Comment 4 Parmendra Kumar 2015-08-31 07:29:44 UTC
I have checked this issue with provided sample project in comment #3 and observed that memory allocation always increase in Application Output.

Screencast: http://www.screencast.com/t/6xny093oJ

ApplicationOutput: https://gist.github.com/Parmendrak/30e57f8991e9deada38d

Please let me know if I can provide more information regarding the same.

Environment info:

Xamarin Studio  5.9.6 (build 22)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
Mono 4.0.4 ((detached/5ab4c0d)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400040001
Xamarin.Android : (Enterprise Edition)
Xcode 6.1.1 (6611)
Xamarin.iOS: (Enterprise Edition)
Mac OS X 10.9.4
Comment 5 Rui Marinho 2015-10-09 07:41:23 UTC
In the attached case if i push and pop a page i get the same number.
Comment 6 Igor 2015-10-09 07:53:05 UTC
Hi Rui,
Try to do multiple iterations back and forth.
If increase is small, try to add bound controls to the 2nd page.

Thanks for help.
Comment 7 Bryan Hunter 2016-08-04 21:37:00 UTC

Between version 1.4.4 and the current stable version of Forms (2.3.1) there have been many "memory leak" fixes. We have ran tests, and this bug appears to have been addressed by one of those fixes.

If you are still experiencing the issue after updating your packages to 2.3.1, please reopen this report with an updated reproduction. For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d 

Warm regards, 
Xamarin Forms Team