-
Improvement
-
Resolution: Fixed
-
Minor
-
None
See https://bugs.openjdk.java.net/browse/JDK-8080225
Basically, FileInputStream and FileOutputStream both use a finalizer to ensure that the resources are closed.
Even with programmers do call close() after using FileInputStream, its finalize() method will still be called. In other words, still get the side effect of the FinalReference being registered at FileInputStream allocation time, and also reference processing to reclaim the FinalReference during GC (any GC solution has to deal with this).
The recommended solution is to switch to Files.newInputStream and Files.newOutputStream respectively as these use a reference queue to clean up unclosed streams that are eligible for GC rather than waiting for a finalizer always.
- is related to
-
JENKINS-45903 transient file handle leak in LargeText.GzipAwareSession.isGzipStream(File)
- Resolved
- relates to
-
JENKINS-45057 "too many files open": file handles leak, job output file not closed
- Resolved
- links to