[Bug libgcj/14751] New: java program compiled with gcj never release system handle resources allocated by new threads on windows platform
alessandro dot pepi at email dot it
gcc-bugzilla@gcc.gnu.org
Sat Mar 27 12:58:00 GMT 2004
A program compiled with gcj on Windows platform (i use the thisiscool
distribution) never release system handle resources allocated by new threads
until the main thread exit.
When a compiled java application create a new thread, the system allocate a
new thread handle and some other system handles. When the new thread exits the
thread handle is released but 3 other system handles (3 per thread) will be
released only when application terminate its execution. Below a java test
program that i have comiled whith the latest windows thisiscool distribution
of gcj:
import java.util.*;
public class TestThread {
public void createThread(final int j){
Runnable run = new Runnable(){
public void run(){
System.out.println("I am thread number "+j);
tsleep(2000,null);
};
};
try{
new Thread(run).start();
}catch(Exception e){
System.out.println(e.toString());
};
};
public void Test(){
for (int i = 0;i<100;i++){
createThread(i);
tsleep(250,null);
};
};
public static void tsleep(long t,String s){
if (s!=null)
System.out.println(s);
try{
Thread.sleep(t);
}catch(Exception e){
System.out.println(e.toString());
}
};
public static void main(String[] args) {
tsleep(5000,"Begin test : look at handles resource on Task Manager before
starting ");
TestThread test = new TestThread();
test.Test();
tsleep(1000,"executing garbage collector ...");
Runtime.getRuntime().runFinalization();
Runtime.getRuntime().gc();
tsleep(10000,"End test : now look again at handles resource on Task
Manager before exiting ");
}
};
--
Summary: java program compiled with gcj never release system
handle resources allocated by new threads on windows
platform
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alessandro dot pepi at email dot it
CC: alessandro dot pepi at email dot it,gcc-bugs at gcc dot
gnu dot org,java-prs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14751
More information about the Gcc-bugs
mailing list