@@ -71,6 +71,15 @@ internal sealed class RamController
71
71
/// Property displaying whether the RAM monitor is enabled or not
72
72
/// </summary>
73
73
internal bool RamMonitorEnabled { get ; private set ; }
74
+ /// <summary>
75
+ /// Property displaying whether the FileSystem cache should be cleared or not during memory optimisation
76
+ /// </summary>
77
+ internal bool ClearFileSystemCache { get ; set ; }
78
+ /// <summary>
79
+ /// Property displaying whether the standby cache should be cleared or not during memory optimisation
80
+ /// </summary>
81
+ internal bool ClearStandbyCache { get ; set ; }
82
+
74
83
#endregion
75
84
76
85
/// <summary>
@@ -99,6 +108,8 @@ internal RamController(Dispatcher dispatcher, SfCircularGauge gauge, Label lblTo
99
108
_lblAvailable = lblAvailable ?? throw new ArgumentNullException ( nameof ( lblAvailable ) ) ;
100
109
101
110
_ramOptimizer = new RamOptimizer ( _logController ) ;
111
+ ClearStandbyCache = true ;
112
+ ClearFileSystemCache = true ;
102
113
103
114
_ramTimer = new Timer ( ) ;
104
115
_ramTimer . Elapsed += OnTimedEvent ;
@@ -176,10 +187,9 @@ private void OnTimedEvent(object source, ElapsedEventArgs e)
176
187
/// <summary>
177
188
/// Clear all non-essential RAM
178
189
/// </summary>
179
- /// <param name="filesystemcache">A boolean to indicate whether or not to clear the FileSystem cache</param>
180
190
/// <param name="exceptionsList">A list of processes that should be excluded from memory optimisation</param>
181
191
/// <returns></returns>
182
- internal async Task ClearMemory ( bool filesystemcache , List < string > exceptionsList )
192
+ internal async Task ClearMemory ( List < string > exceptionsList )
183
193
{
184
194
_logController . AddLog ( new ApplicationLog ( "Clearing RAM memory" ) ) ;
185
195
@@ -190,7 +200,11 @@ await Task.Run(async () =>
190
200
double oldUsage = RamUsage ;
191
201
192
202
_ramOptimizer . EmptyWorkingSetFunction ( exceptionsList ) ;
193
- _ramOptimizer . ClearFileSystemCache ( filesystemcache ) ;
203
+
204
+ if ( ClearFileSystemCache )
205
+ {
206
+ _ramOptimizer . ClearFileSystemCache ( ClearStandbyCache ) ;
207
+ }
194
208
195
209
await Task . Delay ( 10000 ) ;
196
210
0 commit comments