service crashing on close - can allocated/not freed memory cause it ?
Posted on 2008-06-24
Got an application running as service, and has done for ages - it has one problem, whenever i close it, it will crash because i didnt do the proper cleanup/synchronization when i made it.
Im in the process now of fixing this, it looks nasty in the eventlog, and now im regretting i didnt do it proper from start.
My first question is - lets say ive got alot of allocated memory that isnt freed in the end, even though it should be freed, wouldnt it just get rid of itself when the process dies ? it wouldnt cause by itself a crash would it ?
Second question is more codelike; one of the issues i have is that i initiate "kill" events to the threads ive launched, but i dont know when they actually quits, so i send the END, and then let the process die, and guess that is wrong.
How would you normally do this sync and wait for all threads to finish gracefully ?