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

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -