[RELEASE] Memory Usage Cleaner

10/29/2012 23:57 mongreldogg#1
Updated thread.

There is a memory usage info cleaner.
Cleans MemoryUsageInfo.txt every 5 sec using not much CPU and RAM.
How to use: put into GS dir, start and minimize.
Enjoy shit.
May share.
10/30/2012 02:54 marekrndr#2
What the..

[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]
11/09/2012 07:47 mongreldogg#3
Quote:
Originally Posted by marekrndr View Post
What the..

[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]
updated main thread
11/09/2012 22:53 glandu2#4
40kB file for that is pretty big for me, same for your memory usage :o
6 threads, always at least one of them running, just to do something every 5sec, well, you don't have to have 6 threads, and let them running when you want to wait, waste of cpu time :p
11/10/2012 10:40 mongreldogg#5
Quote:
Originally Posted by glandu2 View Post
40kB file for that is pretty big for me, same for your memory usage :o
6 threads, always at least one of them running, just to do something every 5sec, well, you don't have to have 6 threads, and let them running when you want to wait, waste of cpu time :p
joke?
look at cpu using in taskmgr=)
11/10/2012 13:19 marekrndr#6
Code:
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.IO;
using System.Timers;

namespace MUC
{
  [StandardModule]
  internal sealed class Module1
  {
    private static Timer aTimer;

    [STAThread]
    public static void Main()
    {
      int num = 0;
      while (num < 1)
      {
        Module1.aTimer = new Timer(10000.0);
        Module1.aTimer.Elapsed += new ElapsedEventHandler(Module1.OnTimedEvent);
        Module1.aTimer.Interval = 5000.0;
        Module1.aTimer.Enabled = true;
        Console.ReadLine();
      }
    }

    private static void OnTimedEvent(object source, ElapsedEventArgs e)
    {
      try
      {
        File.Delete("MemUsageInfo.txt");
        Console.WriteLine("Memory Usage Info deleting procedure completed at " + Conversions.ToString(DateTime.Now), (object) e.SignalTime);
      }
      catch (Exception ex)
      {
        ProjectData.SetProjectError(ex);
        Console.WriteLine("Memory Usage not found exception at " + Conversions.ToString(DateTime.Now), (object) e.SignalTime);
        ProjectData.ClearProjectError();
      }
    }
  }
}
11/10/2012 14:19 glandu2#7
yes i looked with process explorer, and i saw 6 threads, with at least one consuming cpu time, but yes it's not as if it was 50% of cpu time, but it require the big .NET framework, using .net is not really suitable for just deleting a file every 5sec (without a big framework like that, you can make a program that use 1 thread, take 10 times less memory and the program file size was less that 10kb)

If you want to use .net, add some configuration window to let the user to choose the update time, delete also dump files, automatically restart the server on crashes

and i as see, there is more line of code using c# and .net for that than using C and windows API:
Code:
#include <windows.h>
#include <stdio.h>

int main() {
	SYSTEMTIME sysTime;

	while(1) {
		if(DeleteFile("MemUsageInfo.txt")) {
			GetLocalTime(&sysTime);
			printf("[%02d:%02d:%02d] Memory Usage Info deleted\n", sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
		}
		Sleep(5000);
	}

	return 0;
}
if you want to exit when the user press a key, use PeekConsoleInput and GetStdHandle to know if there is data in stdin
11/10/2012 18:06 mongreldogg#8
so many guru's ahah=)
well done guys.
made by vb 2005 xD didnt have something else at a time.
and so, i dont know C=)

but ive released this shit and its pretty shitty good!

Quote:
Originally Posted by mongreldogg View Post
Enjoy shit.
thats it
11/11/2012 09:46 Tekknoid#9
Why dont use the simple option in your gameserver.opt?

"T game.mem_usage_info_save_interval:0"
11/11/2012 13:28 mongreldogg#10
Quote:
Originally Posted by Tekknoid View Post
Why dont use the simple option in your gameserver.opt?

"T game.mem_usage_info_save_interval:0"
u know.
because im noob.
if i dont know how to do something simply, im doing it other way.
because im noob.
and noob releases for noobs.
so boring...
k nevermind=)