Bug 73691

Summary: Many processes of javaw.exe reside in the memory and never disappear
Product: [Eclipse Project] JDT Reporter: Hong-Hui Chen <sernc>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Hong-Hui Chen CLA 2004-09-10 14:14:42 EDT
I wrote a simple program with GUI. Ever time I run the program and close it, 
the invoked VM, javaw.exe, still keep alive in the memory.  These processes of 
javaw.exe won't be terminated until the Eclipse is closed.  The JDK I 
installed is jdk1.5.0.  The program I wrote as follows:

//-----------------------------------------------------------------------------
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class MyFrame extends JFrame implements ActionListener{
	private JButton button;
	private JLabel label;
	private String name[]={"A","B","C","D"};
	private int idx;
	
	public MyFrame(){		
		super("Test it!");
		
		idx=0;		
		Container c=getContentPane();
		c.setLayout(new FlowLayout(FlowLayout.CENTER));
		label=new JLabel(name[idx]);
		button=new JButton("push me!");
		label.setToolTipText("I am tips!");
		c.add(label);
		c.add(button);
		setSize(800,600);
		setVisible(true);
		button.addActionListener(this);
	}
	
	public static void main(String args[]){
		MyFrame app=new MyFrame();		
	}

	public void actionPerformed(ActionEvent e) {
		if(idx==3)
			idx=0;
		else
			idx++;
		
		label.setText(name[idx]);
		repaint();
	}
	
}

//-----------------------------------------------------------------------------
These processes of javaw.exe do slow down my computer a lot because they 
consume too much memory.
Comment 1 Olivier Thomann CLA 2004-09-10 17:49:58 EDT
This has nothing to do with Eclipse. You have the UI thread that is running and
therefore the program won't exit as long as it is running. You would have the
same problem running from the command line.
You need to exit when the frame is closed.
Close as INVALID.