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 for Bug 60492 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 25541 [details]
A project that demonstrates the memory leak.
We were able to identify a massive memory leak when calling Platform.CreateRenderer and Platform.SetRenderer. We track Xamarin Forms VisualElements and iOS renderers and both seem to leak consistently. Our exact case is a third party ListView control and is relatively complex, but we were able to reproduce the leak in a simple setup.
Our demo setup consists of creating a Xamarin Forms visual element (Grid in the demo project) and creating its renderer by calling Platform.CreateRenderer(). Later, we release the renderer by calling Platform.SetRenderer(grid, null).
We use WeakReference to track whether instances are alive, and we can see that they are never released.
This is a huge problem for us as we do similar operations for each cell in our ListView. Memory piles up quickly.
We observed this on both a simulator and a physical device.
We are attaching a zip containing two folders. One folder contains a runnable project and the other folder contains only the two files needed to reproduce the leak.
I will set this to confirmed until further investigation can be made.
I created a ListView Renderer by myself. and my page is leaked when calling Platform.CreateRenderer(). My problem like this completely. (using dataTemplate.CreateContent() to create ContentView and call Platform.CreateRenderer() to create renderer for ViewCell)
Please help me!
Created attachment 26097 [details]
Button Render is not released!
Replace Grid Element by Button. Renderer of button is not released that is cause.
ButtonRender.NativeView.PreferredFocusedView => ButtonRenderer;
I don't know how to remove reference of ButtonRender.NativeView.PreferredFocusedView. Please give me a idea?
<?xml version="1.0" encoding="UTF-8"?>
<Button Text="button" />
<Button x:Name="ButtonDoTest" Text="Do Test" Clicked="ButtonDoTest_Clicked" Margin="0, 50, 0, 0" />
<Label x:Name="LabelInfo" />