Skip to content

Commit 3243744

Browse files
committed
* Added ability to clear memory on application startup
1 parent 6c2dd3f commit 3243744

File tree

6 files changed

+34
-7
lines changed

6 files changed

+34
-7
lines changed

MemPlus/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
<setting name="WindowRamStatistics" serializeAs="String">
118118
<value>True</value>
119119
</setting>
120+
<setting name="StartupMemoryClear" serializeAs="String">
121+
<value>False</value>
122+
</setting>
120123
</MemPlus.Properties.Settings>
121124
</userSettings>
122125
</configuration>

MemPlus/Properties/Settings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MemPlus/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,8 @@
111111
<Setting Name="WindowRamStatistics" Type="System.Boolean" Scope="User">
112112
<Value Profile="(Default)">True</Value>
113113
</Setting>
114+
<Setting Name="StartupMemoryClear" Type="System.Boolean" Scope="User">
115+
<Value Profile="(Default)">False</Value>
116+
</Setting>
114117
</Settings>
115118
</SettingsFile>

MemPlus/Views/Windows/MainWindow.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ public MainWindow()
105105
MessageBox.Show("MemPlus might not function correctly without administrative rights!", "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
106106
}
107107
}
108+
109+
if (Properties.Settings.Default.StartupMemoryClear)
110+
{
111+
ClearMemory(0);
112+
}
108113
}
109114
catch (Exception ex)
110115
{

MemPlus/Views/Windows/SettingsWindow.xaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,20 @@
142142
<Grid.RowDefinitions>
143143
<RowDefinition Height="Auto" />
144144
<RowDefinition Height="Auto" />
145-
<RowDefinition Height="Auto"/>
145+
<RowDefinition Height="Auto" />
146+
<RowDefinition Height="Auto" />
146147
</Grid.RowDefinitions>
147148
<Grid.ColumnDefinitions>
148149
<ColumnDefinition Width="Auto" />
149150
<ColumnDefinition />
150151
</Grid.ColumnDefinitions>
151-
<CheckBox Grid.Row="0" Grid.Column="0" x:Name="ChbEmptyWorkingSet" Content="Empty working sets" Margin="3" />
152-
<CheckBox Grid.Row="0" Grid.Column="1" x:Name="ChbFileSystemCache" Content="Clear FileSystem cache" Margin="3" />
153-
<CheckBox Grid.Row="1" Grid.Column="0" x:Name="ChbStandByCache" Content="Clear standby cache" Margin="3" />
154-
<CheckBox Grid.Row="1" Grid.Column="1" x:Name="ChbClearClipboard" Content="Clear clipboard data" Margin="3" />
155-
<CheckBox Grid.Row="2" Grid.Column="0" x:Name="ChbHotKey" Content="Hotkey:" Margin="3" />
156-
<TextBox Grid.Row="2" Grid.Column="1" x:Name="TxtHotKey" Margin="3" HorizontalAlignment="Stretch" PreviewKeyDown="TxtHotKey_PreviewKeyDown"/>
152+
<CheckBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ChbStartupMemoryClear" Content="Clear memory on application startup" Margin="3" />
153+
<CheckBox Grid.Row="1" Grid.Column="0" x:Name="ChbEmptyWorkingSet" Content="Empty working sets" Margin="3" />
154+
<CheckBox Grid.Row="1" Grid.Column="1" x:Name="ChbFileSystemCache" Content="Clear FileSystem cache" Margin="3" />
155+
<CheckBox Grid.Row="2" Grid.Column="0" x:Name="ChbStandByCache" Content="Clear standby cache" Margin="3" />
156+
<CheckBox Grid.Row="2" Grid.Column="1" x:Name="ChbClearClipboard" Content="Clear clipboard data" Margin="3" />
157+
<CheckBox Grid.Row="3" Grid.Column="0" x:Name="ChbHotKey" Content="Hotkey:" Margin="3" />
158+
<TextBox Grid.Row="3" Grid.Column="1" x:Name="TxtHotKey" Margin="3" HorizontalAlignment="Stretch" PreviewKeyDown="TxtHotKey_PreviewKeyDown"/>
157159
</Grid>
158160
</GroupBox>
159161
<GroupBox Grid.Row="1" Header="Working Set Exclusions" MinWidth="250" Margin="3">

MemPlus/Views/Windows/SettingsWindow.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ private void LoadProperties()
150150
break;
151151
}
152152

153+
ChbStartupMemoryClear.IsChecked = Properties.Settings.Default.StartupMemoryClear;
153154
ChbEmptyWorkingSet.IsChecked = Properties.Settings.Default.EmptyWorkingSet;
154155
ChbFileSystemCache.IsChecked = Properties.Settings.Default.FileSystemCache;
155156
ChbStandByCache.IsChecked = Properties.Settings.Default.StandByCache;
@@ -281,6 +282,7 @@ private void SaveProperties()
281282
}
282283

283284
//RAM Optimizer
285+
if (ChbStartupMemoryClear.IsChecked != null) Properties.Settings.Default.StartupMemoryClear = ChbStartupMemoryClear.IsChecked.Value;
284286
if (ChbEmptyWorkingSet.IsChecked != null) Properties.Settings.Default.EmptyWorkingSet = ChbEmptyWorkingSet.IsChecked.Value;
285287
if (ChbFileSystemCache.IsChecked != null) Properties.Settings.Default.FileSystemCache = ChbFileSystemCache.IsChecked.Value;
286288
if (ChbStandByCache.IsChecked != null) Properties.Settings.Default.StandByCache = ChbStandByCache.IsChecked.Value;

0 commit comments

Comments
 (0)