c# - Memory Leak from use of DispatcherTimer -


so i'm not greatest @ analyzing memory leaks can tell have located one.

i using timer check if connected , when comment out timer memory leak goes away.

the timer code simple, this:

private system.windows.threading.dispatchertimer embdattachtimer = new system.windows.threading.dispatchertimer(); embdattachtimer.tick += new eventhandler(attachtimer_elapsed); embdattachtimer.interval = new timespan(0, 0, 0, 0, 500); embdattachtimer.start(); 

the code eventhandler "attachtimer_elapsed" follows:

void attachtimer_elapsed(object sender, eventargs e) { battached = isunitattached(); // simple check of usb connection updatecnctstattext(); // calls ui elements update them "connected" or "not connected" } 

the code isunitattached() makes call library driven function checks msp430 processor on other end of usb line.

bool isunitattached {     bsuccess = usbi_msp430.connect();     if (!bsuccess)      {         console.writeline("unable connect.");         return false;      }      return true;  } 

pretty confused this, i've on , using delegate run updatecnctstattext function changed dispatchertimer hoping solve problems made no difference.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -