[Mono-osx] Memory Leak ?

kjpou kjpou at pt.lu
Sun Jan 9 15:33:09 EST 2011


Mathew

It is not a memory leak.

What you have to do is use a NSTimer.

NSTimer t;

             t = NSTimer.CreateRepeatingScheduledTimer(1,delegate {
                  txtClock.StringValue = DateTime.Now.ToLongTimeString();
             });


When you use a .net timer it runs outside NSApplication loop.  The 
NSTimer will run within the application loop allowing Cocoa to update 
the field value correctly.

I plan on writing an article about that in a couple of days.

On 1/9/11 7:52 PM, Matthew Hazlett wrote:
> Timer t = new Timer(1000);


More information about the Mono-osx mailing list