Hi! I’m developing an app that is using a timer in order to send “alive” messages. After some time, my timer stops working and show this error:
[quote]GC: 364msec 385548 bytes used, 12655500 bytes available
Type 0F (STRING ): 38136 bytes
Type 11 (CLASS ): 78444 bytes
Type 12 (VALUETYPE ): 4788 bytes
Type 13 (SZARRAY ): 213480 bytes
Type 15 (FREEBLOCK ): 12655500 bytes
Type 16 (CACHEDBLOCK ): 216 bytes
Type 17 (ASSEMBLY ): 22248 bytes
Type 18 (WEAKCLASS ): 144 bytes
Type 19 (REFLECTION ): 24 bytes
Type 1B (DELEGATE_HEAD ): 504 bytes
Type 1D (OBJECT_TO_EVENT ): 408 bytes
Type 1E (BINARY_BLOB_HEAD ): 192 bytes
Type 1F (THREAD ): 3072 bytes
Type 20 (SUBTHREAD ): 240 bytes
Type 21 (STACK_FRAME ): 3084 bytes
Type 22 (TIMER_HEAD ): 72 bytes
Type 27 (FINALIZER_HEAD ): 18024 bytes
Type 31 (IO_PORT ): 144 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 2256 bytes[/quote]
Here you can see how I defined timer:
public static void Main()
{
...
var thread1 = new Thread(AliveTimer);
...
thread1.Start();
Thread.Sleep(Timeout.Infinite);
}
...
static void AliveTimer()
{
System.Threading.Timer timer;
timer = new System.Threading.Timer(new TimerCallback(MyCallBack), null, 0, 10000);
}
...
static void MyCallBack(object data)
{
Debug.Print("Gateway ALIVE");
}
Thanks!!!