Java, Programming, Multithreading, Software Development, Software Engineering.
References: To prevent memory leaks, ThreadLocalMap uses weak references for the ThreadLocal instances. Weak references allow the garbage collector to collect ThreadLocal instances when they are no longer reachable from the application code, even if they are still referenced in the ThreadLocalMap.