I accidentally found a problem in my application. I am using a template MVVM. If I start switching between views RAM starts fill up and dont free up.
Before https://i.stack.imgur.com/MBxG7.jpg
After 1 munute of simply views changing https://i.stack.imgur.com/fKh0t.jpg
I really dont know how find there is the problem. I will give you as much information as you need
I initialize all of views in MainWindowViewModel(it init first when app starts)
private static ViewModel1 VM1;
private static ViewModel2 VM2;
public MainWindowViewModel()
{
VM1 = VM1?? new ViewModel1();
VM2 = VM2?? new ViewModel2();
}
To get instance of any view I user this
public static ViewMidel1 GetVM1()
{
if (VM1 == null)
VM1 = new ViewMidel1();
return VM1 ;
}
In other view
ViewMidel1 vm = MainWindowViewMidel.GetVM1();
All views are UserControls. When view changed all view get properties triggered.
Maybe i do something wrong?
Constructors of views calls only when programm starts.
Diagsession https://gofile.io/?c=pamZlT
UPDATE 1:
I delete all code from all VM and its dont help. Something wrong with xaml. https://i.stack.imgur.com/YcqSZ.jpg
UPDATE 2: This xaml add ~15-20 mb in RAM every time I select view. Image size 108kb
<Ellipse Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2" Grid.RowSpan="2" Margin="5,5,5,5">
<Ellipse.Fill>
<ImageBrush ImageSource="/Resources/Images/image.jpg" Stretch="UniformToFill"/>
</Ellipse.Fill>
</Ellipse>