1.1 --- a/core/sm_srvcmds.cpp Thu Jun 07 02:26:06 2007 +0000
1.2 +++ b/core/sm_srvcmds.cpp Thu Jun 07 02:36:54 2007 +0000
1.3 @@ -15,6 +15,7 @@
1.4 #include "sm_srvcmds.h"
1.5 #include "sm_version.h"
1.6 #include "sm_stringutil.h"
1.7 +#include "HandleSys.h"
1.8
1.9 RootConsoleMenu g_RootMenu;
1.10
1.11 @@ -254,3 +255,24 @@
1.12 {
1.13 g_RootMenu.GotRootCmd();
1.14 }
1.15 +
1.16 +CON_COMMAND(sm_dump_handles, "Dumps Handle usage to a file for finding Handle leaks")
1.17 +{
1.18 + if (engine->Cmd_Argc() < 2)
1.19 + {
1.20 + g_RootMenu.ConsolePrint("Usage: sm_dump_handles <file>");
1.21 + return;
1.22 + }
1.23 +
1.24 + const char *arg = engine->Cmd_Argv(1);
1.25 + FILE *fp = fopen(arg, "wt");
1.26 + if (!fp)
1.27 + {
1.28 + g_RootMenu.ConsolePrint("Could not find file \"%s\"", arg);
1.29 + return;
1.30 + }
1.31 +
1.32 + g_HandleSys.Dump(fp);
1.33 +
1.34 + fclose(fp);
1.35 +}