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 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.
Created attachment 11692 [details]
A customer is reporting that when updating the OC bound to a ListView that references to certain objects are never dereferenced. Below are his comments and attached is a sample application that exhibits this behavior as well as the results from his heapshot analysis.
Attempted on: 18.104.22.16859 and with 22.214.171.12464-pre3
"I ran the app using the Mono Heapshot tool and cycled through the even, odd, and all filters once. Then I went through several iterations where I would capture a snapshot and then cycle through the filters. I ended up with five heap snapshots. I used the tool to compare the delta of the number of instance of types between successive snapshots. I would expect the number of instances between snapshots to be roughly the same, especially since I modified the code to call CG.Collect() each time the filter changed.
However, I see that the number of instances of several types is increasing without bound, implying that there is a memory leak. This may be related to the memory leak that you alluded to in your previous e-mail, but I wanted you to have the information that we gathered in case it was helpful. I have attached a spreadsheet that shows the information I collected. Note that the numbers in each column represent the increase in the number of instances between two snapshots, not the absolute number of instances (which is much greater).
Given the types that are leaking, our suspicion is that the way we are reusing the view model when the filter changes is somehow causing Xamarin.Forms to not unregister event handlers when they are no longer needed and re-register them multiple times on the same objects. If this is true, then when something like a property change event is raised, it would fire many times, chewing up CPU time. This might explain some of the slowdown we are seeing."
This is similar to https://bugzilla.xamarin.com/show_bug.cgi?id=30678 but in this case the items within the OC are being replaced vs replacing the entire list.
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer 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
Xamarin Forms Team