Skip to content

Commit c3334cf

Browse files
committed
Add a debug command for forcing garbage collection
1 parent 78a3105 commit c3334cf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/MHServerEmu/Commands/Implementations/DebugCommands.cs

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ public string Test(string[] @params, FrontendClient client)
2424
return string.Empty;
2525
}
2626

27+
[Command("forcegc", "Requests the garbage collector to reclaim unused server memory.", AccountUserLevel.Admin)]
28+
public string ForceGC(string[] @params, FrontendClient client)
29+
{
30+
GC.Collect();
31+
GC.WaitForPendingFinalizers();
32+
33+
return "Manual garbage collection successfully requested.";
34+
}
35+
2736
[Command("cell", "Shows current cell.", AccountUserLevel.User)]
2837
public string Cell(string[] @params, FrontendClient client)
2938
{

0 commit comments

Comments
 (0)