-
Enhancement
-
Resolution: Duplicate
-
P3
-
None
-
1.0
-
sparc
-
solaris_2.4
Some resources can only be reclaimed by finalization. But running out
does not cause finalization to occur. Sometimes it should.
For instance, construction a java.io.FileInputStream(String) does a
Unix open, and associates a Unix file with the FileInputStream object.
Unless an explicit close() is done on the FileInputStream, the Unix
file is not closed until finalization, even if the FileInputStream
object has been discarded. A program can get a IOException when
creating one too many of these, even if most are discarded.
If the FileInputStream gets EMFILE on open, it should call the
finalizer to see if that frees any Unix file descriptors, then try
opening again.
does not cause finalization to occur. Sometimes it should.
For instance, construction a java.io.FileInputStream(String) does a
Unix open, and associates a Unix file with the FileInputStream object.
Unless an explicit close() is done on the FileInputStream, the Unix
file is not closed until finalization, even if the FileInputStream
object has been discarded. A program can get a IOException when
creating one too many of these, even if most are discarded.
If the FileInputStream gets EMFILE on open, it should call the
finalizer to see if that frees any Unix file descriptors, then try
opening again.
- duplicates
-
JDK-4027749 difficult to recover from running out of file descriptors
- Closed
- relates to
-
JDK-1229091 Finalization not done at exit() and is unnecessarily unreliable
- Closed