File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
managed/CounterStrikeSharp.API/Core/Memory Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -25,5 +25,7 @@ public interface IMemoryManager
2525 public void Stop ( bool forceStop = false ) ;
2626
2727 public void Resume ( ) ;
28+
29+ public void ForceCollect ( int generation , GCCollectionMode mode , bool blocking ) ;
2830 }
2931}
Original file line number Diff line number Diff line change @@ -260,6 +260,11 @@ public void Resume()
260260 _logger . LogInformation ( "Service has been resumed" ) ;
261261 }
262262
263+ public void ForceCollect ( int generation , GCCollectionMode mode , bool blocking )
264+ {
265+ GC . Collect ( generation , mode , blocking ) ;
266+ }
267+
263268 private void BackgroundThread ( )
264269 {
265270 _logger . LogInformation ( "Service has been started" ) ;
@@ -287,7 +292,7 @@ private void BackgroundThread()
287292 DateTime startTime = DateTime . UtcNow ;
288293
289294 // 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 ) ;
291296
292297 // this might be obsolete with 'blocking: false'?
293298 GC . WaitForPendingFinalizers ( ) ;
You can’t perform that action at this time.
0 commit comments