-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Describe the bug
Hi, I found a memory leak by using WhenActivated in a view.
If we don't dispose the disposable returned by WhenActivated, it seems that the view and their elements are kept in memory.
With memory leak
public BookView()
{
InitializeComponent();
this.WhenActivated(d => { ... });
}
Without
public BookView()
{
InitializeComponent();
IDisposable l_disp = Disposable.Empty;;
this.WhenActivated(d =>
{
...
d(l_disp);
});
}
Steps To Reproduce
- Run my simple application WPAFApplication.exe
- click a lot of time on "add" button to add objects in the list.
2.1 Left list is the base case with a memory leak
2.2 Right list is the 'fixed way' by disposing WhenActivated return - then click on clear button
- make a snapshot with dot memory
Expected behaviour
We shouldn't have any view model retained by their views.
Environment
- OS: W10
- ReactiveUI Version: 16.2.6 and 16.2.1
Additional context
Have a good day :)
HavenDV, kronic and bawkee

