Re: Life of a thread

From: J. Buelna - Houston, TX (
Date: 03/22/05

Date: Tue, 22 Mar 2005 17:38:05 -0600

"Zeng" <> wrote in message
> Hi,
> If a thread goes out of scope and the working proc (ThreadStart) is done
> processing, does it eventually get finalized just like unreferenced
> memory?
> thanks!

Yes. Unless, of course, you have unmanaged resources (like a database
connection) in the thread. Then you may eventually wind up with a
noticeable leak. You can use a class to govern the thread. Make sure it
inherits : IDisposable and add a ~Destructor to handle all unmanaged

You may also want to run the worker thread with the IsBackground property
set to true so destruction happens immediately if the main app is

J. Buelna - Houston, TX