File tree 2 files changed +8
-1
lines changed
managed/CounterStrikeSharp.API/Core/Memory
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -25,5 +25,7 @@ public interface IMemoryManager
25
25
public void Stop ( bool forceStop = false ) ;
26
26
27
27
public void Resume ( ) ;
28
+
29
+ public void ForceCollect ( int generation , GCCollectionMode mode , bool blocking ) ;
28
30
}
29
31
}
Original file line number Diff line number Diff line change @@ -260,6 +260,11 @@ public void Resume()
260
260
_logger . LogInformation ( "Service has been resumed" ) ;
261
261
}
262
262
263
+ public void ForceCollect ( int generation , GCCollectionMode mode , bool blocking )
264
+ {
265
+ GC . Collect ( generation , mode , blocking ) ;
266
+ }
267
+
263
268
private void BackgroundThread ( )
264
269
{
265
270
_logger . LogInformation ( "Service has been started" ) ;
@@ -287,7 +292,7 @@ private void BackgroundThread()
287
292
DateTime startTime = DateTime . UtcNow ;
288
293
289
294
// some may go to gen1 or even gen2, but even those are released when this nondeterministic wonder wants so
290
- GC . Collect ( 0 , GCCollectionMode . Default , true ) ;
295
+ ForceCollect ( 0 , GCCollectionMode . Default , true ) ;
291
296
292
297
// this might be obsolete with 'blocking: false'?
293
298
GC . WaitForPendingFinalizers ( ) ;
You can’t perform that action at this time.
0 commit comments