JDK-4410846 : Unstarted Thread causes memory leak
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-02-01
  • Updated: 2001-02-01
  • Resolved: 2001-02-01
Related Reports
Duplicate :  
Description

Name: krC82822			Date: 02/01/2001


01 Feb 2001, eval1127@eng -- this is apparently related to # 4229558.
However, that bug's synopsis is stated in terms of an inconsistency
between 1.1.x and Java 2, and is thus hard for users to quickly
find/identify the underlying problem on the Bug Parade.
Am opening a separate bug purely for tracking purposes (will dupe to
#4229558)
-------------
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

Threads that are not started cause a memory leak, and are never garbage
collected even if they have no pointers referencing them.
The following code will show this, I used OptimizeIt 4.0 to determine this
memory leak.

public class ThreadTest {

  
    public static void main(String args[]) {
	while (true) {
	  try {
        Thread t = new Thread();
	  // start thread for memory leak workaround
//        t.start();
	  t = null;
        System.gc();
	  Thread.sleep(500);
	} catch (InterruptedException ie) {
		ie.printStackTrace();
	}
        }
    }

}
(Review ID: 116183) 
======================================================================

Comments
EVALUATION 01 Feb 2001, kevin.ryan@eng -- apparent dupe of # 4229558.
11-06-2004

WORK AROUND Name: krC82822 Date: 02/01/2001 make sure that the Thread is always started. ======================================================================
11-06-2004

PUBLIC COMMENTS (see bug # 4229558)
10-06-2004