Does ThreadLocal automatically clear values created for already finished threads?
Does ThreadLocal automatically clear values created for already finished threads?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, the variables are made available for Garbage collections but only if there are no other references to those values (held by some other thread). But when you say a thread is finished, it shouldn’t be like a pooled threads. Pooled threads should clear their own variables before they are put back to pool.