diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2017-01-12 14:43:57 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2017-01-12 13:43:57 -0800 |
commit | ba7b66b83a83328f56e0676efcff5d3c553ac6bf (patch) | |
tree | 0d77274282c801aaadd3954850703f21b3967285 /Xamarin.Forms.Controls.Issues | |
parent | b6cb64e4930de9b16309f2d30c6bb0a2177048fd (diff) | |
download | xamarin-forms-ba7b66b83a83328f56e0676efcff5d3c553ac6bf.tar.gz xamarin-forms-ba7b66b83a83328f56e0676efcff5d3c553ac6bf.tar.bz2 xamarin-forms-ba7b66b83a83328f56e0676efcff5d3c553ac6bf.zip |
Fix out-of-memory crashes on iOS when creating maps (#467)
* Pool map views on iOS 10 to avoid memory issues
Clean up disposal implementation for map renderer, delegate
* Enable 39489 test on iOS
* Add missing XF Maps references
* Add missing maps reference to Windows 8.1 project
* Actually enable the test for iOS
* Fix placement of Isolate override
* Don't create a new control for ImageRenderer if NewElement is null
* Reverting fixes to ViewRenderer Dispose; have to fix that in a separate PR
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39489.cs | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39489.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39489.cs index 3fe44681..0e04fcd5 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39489.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39489.cs @@ -2,6 +2,7 @@ using Xamarin.Forms.CustomAttributes; using Xamarin.Forms.Internals; using System.Threading; using System; +using System.Diagnostics; using System.Threading.Tasks; using Xamarin.Forms.Maps; @@ -13,7 +14,7 @@ using NUnit.Framework; namespace Xamarin.Forms.Controls.Issues { [Preserve(AllMembers = true)] - [Issue(IssueTracker.Bugzilla, 39489, "Memory leak when using NavigationPage with Maps", PlatformAffected.Android)] + [Issue(IssueTracker.Bugzilla, 39489, "Memory leak when using NavigationPage with Maps", PlatformAffected.Android | PlatformAffected.iOS)] public class Bugzilla39489 : TestNavigationPage { protected override void Init() @@ -22,7 +23,6 @@ namespace Xamarin.Forms.Controls.Issues } #if UITEST -#if !__IOS__ // Temporarily disabling this test on iOS protected override bool Isolate => true; @@ -44,19 +44,40 @@ namespace Xamarin.Forms.Controls.Issues } } #endif -#endif + } + + public class Bz39489Map : Map + { + static int s_count; + + public Bz39489Map() + { + Interlocked.Increment(ref s_count); + Debug.WriteLine($"++++++++ Bz39489Map : Constructor, count is {s_count}"); + } + + ~Bz39489Map() + { + Interlocked.Decrement(ref s_count); + Debug.WriteLine($"-------- Bz39489Map: Destructor, count is {s_count}"); + } } [Preserve(AllMembers = true)] public class Bz39489Content : ContentPage { + static int s_count; + public Bz39489Content() { + Interlocked.Increment(ref s_count); + Debug.WriteLine($">>>>> Bz39489Content Bz39489Content 54: Constructor, count is {s_count}"); + var button = new Button { Text = "New Page" }; var gcbutton = new Button { Text = "GC" }; - var map = new Map(); + var map = new Bz39489Map(); button.Clicked += Button_Clicked; gcbutton.Clicked += GCbutton_Clicked; @@ -76,5 +97,11 @@ namespace Xamarin.Forms.Controls.Issues { Navigation.PushAsync(new Bz39489Content()); } + + ~Bz39489Content() + { + Interlocked.Decrement(ref s_count); + Debug.WriteLine($">>>>> Bz39489Content ~Bz39489Content 82: Destructor, count is {s_count}"); + } } }
\ No newline at end of file |