Is a dead thread a threat to memory usage? Will it eventually get collected by the GC?
A dead thread, as any other object, will be collected by the GC if cannot be reached by any references to it. Setting ALL variables that point to it to null
should make it available for collection by the GC.
A threat to memory usage ... it depends on how much memory you're using in it - and how many references to other object instances (Lists, Hashtables, ...). It's exactly the same threat to memory usage as any other type of 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