ReactiveUI memory usage

I recently updated the MVVM application to use ReactiveUI. Basically, I changed a lot of code in ViewModels to use ReactiveLists, derived lists, and ObservableAsPropertyHelpers. As soon as I finished, I noticed that the memory usage in this application lasted from 100 MB to 550 MB (in the same situation, with the same data and functions).

I have a large (~ 3000) number of objects from the same class and using the diagnostic tools from VS, I noticed that OAPH from this class (there are 5 of them) uses a lot of memory. At first I solved the problem with threads, so I decided to try and reproduce the problem in a test application.

For this, I created a ViewModel:

public class ItemViewModel : ReactiveObject
{
    private ObservableAsPropertyHelper<bool> myVar1;
    public bool MyProperty1
    {
        get { return myVar1.Value; }
    }

    public ItemViewModel()
    {
        myVar1 = Observable.Return(false).ToProperty(this, x => x.MyProperty1);
    }
 }

I removed 3 other OAPHs that are strictly identical for peers.

My main ViewModel looks like this:

public class MainViewModel : ReactiveObject
{
    public IReactiveList<ItemViewModel> Items { get; private set; }

    public MainViewModel()
    {
        var items = new List<ItemViewModel>();
        for (int i = 0; i < 3000; i++)
        {
            items.Add(new ItemViewModel());
        }
        Items = new ReactiveList<ItemViewModel>(items);
    }
}

, . , 35 . ItemViewModel, 11.5 . , , , .

: - ? ReactiveUI "" ?

+4

All Articles