JRE 5.0 Update 17 encounters quickly java.lang.OutOfMemoryError,
when opening zip files in a loop.
The issue is quite easily reproducible on JRE 5.0 by running the following
testcase.
1. Testcase
-----------
The testcase consists of the following files:
3462 Apr 15 09:59 ZipFileRepeatOOM.java
139659 Apr 15 09:59 longEntries.zip
The zip file "longEntries.zip" is opened over and over after renaming it in
every iteration.
2. Compile
----------
/jdk1.5.0_17/bin/javac ZipFileRepeatOOM.java
3. Run
------
3.1 Client VM
-------------
% mv longEntries.zip_<nn> longEntries.zip
% /jdk1.5.0_17/bin/java -client -Xms64m -Xmx64m -XX:MaxPermSize=32m -DresultCount=0 ZipFileRepeatOOM longEntries.zip
Set input file specification to "longEntries.zip"
1
[ ... ]
30668
30669
30670
30671
30672
Exception in thread "main" java.lang.OutOfMemoryError
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:203)
at java.util.zip.ZipFile.<init>(ZipFile.java:84)
at ZipFileRepeatOOM.reproduceOOM(ZipFileRepeatOOM.java:44)
at ZipFileRepeatOOM.main(ZipFileRepeatOOM.java:112)
%
3.2 Server VM
-------------
% mv longEntries.zip_<nn> longEntries.zip
% /jdk1.5.0_17/bin/java -server -Xms64m -Xmx64m -XX:MaxPermSize=32m -DresultCount=0 ZipFileRepeatOOM longEntries.zip
Set input file specification to "longEntries.zip"
1
[ ... ]
61362
61363
61364
61365
Exception in thread "main" java.lang.OutOfMemoryError
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:203)
at java.util.zip.ZipFile.<init>(ZipFile.java:84)
at ZipFileRepeatOOM.reproduceOOM(ZipFileRepeatOOM.java:44)
at ZipFileRepeatOOM.main(ZipFileRepeatOOM.java:112)
%