JDK-6422556 : (thread spec) ThreadLocal.remove() documentation needs improvement wrt reclaiming objects
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 5.0
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2006-05-05
  • Updated: 2018-09-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
This was for a time CR 6254531 "(spec thread) ThreadLocal leak when value references ThreadLocal". However that CR has been converted to a Dolphin RFE and this CR will carry the doc improvement.

Users expect automagic reclaiming of thread local objects and the ThreadLocal design ultimately ties reclamation guarantees to Thread lifetimes. That is, until a Thread instance returns from its run method or otherwise terminates normally enough that normal exit actions take plce, locals can be "trapped." This is especially terrible when a local is self-referencing or involved with a reference cycle or there is an explicit reference to the Thread instance involved. 

To the extent possible the ThreadLocal javadoc needs to be improved to give users the opportunity to understand the limitations some (e.g. Sun's) implementation may impose, how to use ThreadLocal.remove when possible, and any strategies compatible with API documentation constraints. A specific suggested fix to follow.

Comments
EVALUATION This is needed.
05-05-2006