Suspected regression: fix for 6735255 causes delay in GC of ZipFile InputStreams, increase in heap demand

Alan Bateman Alan.Bateman at oracle.com
Fri Mar 25 13:30:46 UTC 2011


Neil Richards wrote:
> Hi,
> I've noticed that the fix introduced to address bug 6735255 [1] [2] had
> an unfortunate side-effect.
>
> That fix stores references to the InputStream objects returned from
> ZipFile.getInputStream(ZipEntry) in a HashSet (within ZipFile), so that
> the close() method may be called upon those objects when ZipFile.close()
> is called.
>
> It does this to conform to the existing API description, and to avoid a
> native memory leak which would occur if the InputStream is GC'd without
> its close() being called.
>
> However, by holding these InputStreams in a set within their ZipFile
> object, their lifecycle is now prolonged until the ZipFile object either
> has its close() method called, or is finalized (prior to GC).
>
>   
I've created 7031076 to track this and generated a webrev from the 
change-set that you attached:
  http://cr.openjdk.java.net/~alanb/7031076/webrev/

Sherman mentioned off-list that he plans to look at this.

-Alan.






More information about the core-libs-dev mailing list