Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] ListView(Adapter) is leaking memory (Cells and their Native Views) and causes ObjectDisposed exception for custom cells that properly implement dispose for their native view. #9721

Open
rheesbeen opened this issue Feb 26, 2020 · 0 comments
Labels
a/listview Problems with the ListView/TableView a/performance i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/Android t/bug 🐛
Projects

Comments

@rheesbeen
Copy link

Description

Listview(Adapter) is leaking memory (Cells and their Native Views) and causes ObjectDisposed exception for custom cells that properly implement dispose for their native view.

Steps to Reproduce

I supplied a minimal project to reproduce this using the TextCell, TextCell1 is the same as provided by forms, TextCell2 implements dispose properly.

Navigate back and forth using the Test1 button this will fire OnCellPropertyChanged as may times as you navigated back and forth.

Navigate back and forth using the Test2 button this will throw a ObjectDisposed exception the second time you press the Test2 button.

Expected Behavior

OnCellPropertyChanged shouldn't be called at all and no ObjectDisposed exception should be thrown. The Listview(Adapter) should properly release its cells by clearing the bindingcontext and the native view for the cell should dispose its native child views.

Actual Behavior

The Listview(Adapter) isn't clearing the bindingcontext for the cells, which causes the cells to hang around (leak memory) and get notified of changes in the viewmodel, which causes OnCellPropertyChanged to be called on (old) none visual cells. The current implementation seems to be working because the child views of the native view for the cells aren't properly disposing of their child views (which also causes memory leaks) and still update (old) none visual native views.

Basic Information

Forms: V4.3.0.908675 (But probably effects all versions).
Platforms: Android (didn't test other platforms, but the same problem likely exists).

Reproduction Link

App14.zip

@rheesbeen rheesbeen added s/unverified New report that has yet to be verified t/bug 🐛 labels Feb 26, 2020
@pauldipietro pauldipietro added this to New in Triage Feb 26, 2020
@jsuarezruiz jsuarezruiz added a/listview Problems with the ListView/TableView a/performance p/Android i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often labels Feb 26, 2020
@jsuarezruiz jsuarezruiz moved this from New to Needs Estimate in Triage Feb 26, 2020
@jsuarezruiz jsuarezruiz removed the s/unverified New report that has yet to be verified label Feb 26, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 14, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/listview Problems with the ListView/TableView a/performance i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/Android t/bug 🐛
Projects
Triage
  
Needs Estimate
Development

No branches or pull requests

3 participants