Hi
I tried to spawn a thread on button clicking event. Inside the thread function i have the code for moving some graphical objects on the winform
For each button click new thred is started . I have noticed that it is making the 'memory uage' and 'handles' are getting increased
Do I have to kill the thread manually ??
thanx in advanc
XYZ
Nick Wienholt - 13 Apr 2004 12:33 GMT
Use the thread pool - creating threads is an expensive operation. The
resources used by a thread object will eventually be reclaimed, but it will
take a few GC cycles.
You'll also need to BeginInvoke to get back to the UI thread, so unless
you're doing expensive operations before the moving, the best option will be
to do the work on the UI thread.
Nick Wienholt, MVP
Maximizing .NET Performance
http://www.apress.com/book/bookDisplay.html?bID=217
Sydney Deep .NET User Group www.sdnug.org
www.dotnetperformance.com
> Hi,
> I tried to spawn a thread on button clicking event. Inside the thread function i have the code for moving some graphical objects on the winform.
[quoted text clipped - 3 lines]
> thanx in advance
> XYZ
cody - 17 Apr 2004 21:41 GMT
> I tried to spawn a thread on button clicking event. Inside the thread function i have the code for moving some graphical objects on the winform.
> For each button click new thred is started . I have noticed that it is making the 'memory uage' and 'handles' are getting increased.
> Do I have to kill the thread manually ??
Every thread has its own stack and a thread handle. If the thread function
returns, all resources are automatically freed.

Signature
cody
[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk