-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.3.0
-
sparc
-
solaris_2.6
JDK 1.3 java.awt.MediaTracker.waitForAll() does not close image files which
causes a leak in file descriptors.
A test example which demonstrates this problem.
===== test.java ========
import java.net.*;
import java.awt.*;
public class test1 {
public static void main (String argv[]) {
Component comp = new Canvas();
MediaTracker tracker = new MediaTracker(comp);
Image image = null;
try {
image = Toolkit.getDefaultToolkit().getImage(new URL("file:/tmp/im0.gif"));
} catch (MalformedURLException mue) {
System.out.println(" failed: Unexpected " + mue);
}
try {
tracker.addImage(image, 0);
try {
tracker.waitForAll();
} catch (InterruptedException ie) {
System.out.println(" failed: Unexpected " + ie);
return;
}
tracker.removeImage(image, 0);
} finally {
image.flush();
System.out.println("QUIT");
System.exit(0);
}
}
}
In the example above the following file "/tmp/im0.gif" wouldn't be closed directly after it was read. In this example the file would be closed only
by the system _exit() call when VM dies. (Analyse requests to the OS system
libraries)
causes a leak in file descriptors.
A test example which demonstrates this problem.
===== test.java ========
import java.net.*;
import java.awt.*;
public class test1 {
public static void main (String argv[]) {
Component comp = new Canvas();
MediaTracker tracker = new MediaTracker(comp);
Image image = null;
try {
image = Toolkit.getDefaultToolkit().getImage(new URL("file:/tmp/im0.gif"));
} catch (MalformedURLException mue) {
System.out.println(" failed: Unexpected " + mue);
}
try {
tracker.addImage(image, 0);
try {
tracker.waitForAll();
} catch (InterruptedException ie) {
System.out.println(" failed: Unexpected " + ie);
return;
}
tracker.removeImage(image, 0);
} finally {
image.flush();
System.out.println("QUIT");
System.exit(0);
}
}
}
In the example above the following file "/tmp/im0.gif" wouldn't be closed directly after it was read. In this example the file would be closed only
by the system _exit() call when VM dies. (Analyse requests to the OS system
libraries)