Bug 45593 - UWP: NavigationPage leaks memory
Summary: UWP: NavigationPage leaks memory
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-10-17 18:44 UTC by fjordfnord
Modified: 2017-12-07 17:37 UTC (History)
6 users (show)

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

Reproducing VS project (80.12 KB, application/x-gzip)
2016-10-17 18:44 UTC, fjordfnord

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 fjordfnord 2016-10-17 18:44:13 UTC
Created attachment 18090 [details]
Reproducing VS project

=== Overview ===

On UWP, using Xamarin.Forms, repeatedly pushing/popping a page to NavigationPage results in ever increasing memory consumption.

A tarball containing a reproducing project is attached.

This might be duplicate of https://bugzilla.xamarin.com/show_bug.cgi?id=31171 , but 31171 doesn't seem to be UWP specific and seems rather old bug. The workaround suggested in 31171 doesn't seem to work here.

=== Steps to Reproduce  ===

Use the attached example project. Start the example, keep clicking the "Show Page" button, observe memory consumption shown by Visual Studio. The button click will call this function:

        public async Task ShowPage()
            if (currentPage != null)
                await Detail.Navigation.PopAsync();
                currentPage = null;
                Debug.Assert(Detail.Navigation.NavigationStack.Count == 1);

            currentPage = new DetailPage();
            await Detail.Navigation.PushAsync(currentPage);
            Debug.Assert(Detail.Navigation.NavigationStack.Count == 2);

=== Expected Behavior ===

Memory consumption should stabilize over time.

=== Actual Behavior ===

Memory consumption only goes up over time.

=== Visual Studio===

Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Community

Visual Basic 2015   00322-20000-00000-AA752
Microsoft Visual Basic 2015

Visual C# 2015   00322-20000-00000-AA752
Microsoft Visual C# 2015

Visual C++ 2015   00322-20000-00000-AA752
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-20000-00000-AA752
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   7.9.01013.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1   14.1.20810.0
ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

AWS Toolkit for Visual Studio 2015
AWS Toolkit for Visual Studio 2015.
Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.

This software includes third party software subject to the following copyrights:
- Logging from log4net, Apache License 
- Putty for PPK to PEM conversion, MIT license 
- NGit for AWS Elastic Beanstalk incremental push
- NSch dependency for NGit
- Sharpen dependency for NGit
- ICSharpCode.SharpZipLib dependency for NGit
- Mono.Posix.dll and Mono.Security.dll dependencies for NGit
- MPFProj for Visual Studio Project Framework
- JSON Checker for JSON validation

Azure App Service Tools v2.8.1   14.0.11123.0
Azure App Service Tools v2.8.1

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft .NET Core Tools (Preview 2)   14.1.20810.0
Microsoft .NET Core Tools (Preview 2)

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25527.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (3b7df6f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (96c7ba6)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS (ad1cd42)
Visual Studio extension to enable development for Xamarin.iOS.

=== Operating System ===

OS Name	Microsoft Windows 10 Home
Version	10.0.14393 Build 14393
Comment 1 Lee McPherson 2016-10-25 05:01:35 UTC
I'm seeing the same effect on UWP with the Xamarin.Forms
Comment 2 Rui Marinho 2016-12-06 12:05:44 UTC
Should be fixed in 2.3.4-pre2