JDK-4006245 : Thread.exit should set target to null
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 1996-09-26
  • Updated: 1997-10-23
  • Resolved: 1997-10-23
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.
1.1 1.1Fixed
When a thread exits, we should set target to null:

    private void exit() {
	if (group != null) {
	    group = null;
        target = null;  // new line

We are observing that the conservative garbage collector occasionally has
quite long delays between a thread exiting and its Thread object being
collected.  We have verified that there are no instance, static, or array
references to the thread object using the Kona reffinder.  Therefore, it
appears that thread exit does something that tends to leave unfortunate
values on the stack or somewhere else.

Therefore, the object connected to the thread is also not collected.
Setting this to null allows this to happen.  These objects are often
sizable, as they're the head of an entire graph corresponding to an

Tim's opinions on aggressive nulling, from email:

>I think that your program of aggressive nulling sounds appropriate.
>We would expect to get a lot of false keeps due to values in dead
>locals, etc. that the collector is too stupid to ignore, as well as
>stuff on the C stack.  But I'm also sure that there is a lot of slop
>in the code, like in this Thread.exit example, that isn't really the
>fault of the collector.  I'm really glad that you guys wrote your
>reference finder tool.

alan.bishop@Eng 1996-09-25

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.1 FIXED IN: 1.1 INTEGRATED IN: 1.1

EVALUATION See Description for discussion