I have developed one window application in C# where i am creating one thread to perform one schedule event. now this application will run the whole day and it will create one thread for each execution of each event. How to remove threads from memory after task assigned to that thread is completed. I dont want to restrict number of threads creation by using thread pool and assigning it a specific count for max thread.
As soon as a thread finishes its execution, it will no longer consume memory and it will be targeted for the garbage collector to collect it. Thus, you don't need to worry about it. However if you are using Task
, it is a good practice to Dispose
it when it finishes its execution. The Task
is IDisposable
object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With