J2SE Version (please include all output from java -version flag): java version "1.6.0-ea" Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b38) Java HotSpot(TM) Client VM (build 1.6.0-ea-b38, mixed mode, sharing) Does this problem occur on J2SE 1.4.x or 5.0.x ? Yes / No (pick one) According to Bug Reports 4827358 and 4867874 it was fixed in 1.5(tiger), however I can't seem to find a version with it working. Operating System Configuration Information (be specific): Microsoft Windows 2000 [Version 5.00.2195] Hardware Configuration Information (be specific): Desktop Bug Description: Regression: Memory allocation doesn't wait for finalization to catch up. See bug Report 4827358 for more details. Sun decided not to fix the bug properly, but instead decided to remove finalize() from everywhere (basically stating that finalize is a useless feature that should not be used). Bug Reports 4827358 and 4867874 state that Sun was meant to have removed finalize() and replaced it with the Java 2D Disposer mechanism. Sure enough even in 1.6.0-ea javax.imageio.stream.ImageInputStreamImpl still has the finalize() method and is still causing OutOfMemoryErrors. Basically each instance of ImageInputStreamImpl is holding a lot of data that is not getting used while it waits for it's turn to be finalized, and hence the OutOfMemoryErrors are thrown. Steps to Reproduce (be specific): run the code: (at some point in time you will see the error java.lang.OutOfMemoryError: Java heap space) The lines: FileImageInputStream[] streams = new FileImageInputStream[numberOfStreams]; for (int i = 0; i < numberOfStreams; i++) { streams[i] = new FileImageInputStream(file); } streams = null; are not required and are there simply to prove the max heap space is big enough to hold numberOfStreams streams. Expected: program to complete normally. Actual: Error: java.lang.OutOfMemoryError: Java heap space Also note that the error report is stating that there is a problem with java's finalize implemention not just these specific examples. In many other reports Sun has said for people to remove their finalize methods (basically finalize should be deprecated and is a useless feature). Sun is still using finalize in other places as well such as Fonts and ShellFolders, which is also a problem but not as noticable due to these objects being a lot smaller hence would take a very long time to cause an OutOfMemoryError for a system with a normal heap space. ColorIndexModel is probably a larger object which also uses finalize, however so far this has not being causing us OutOfMemoryErrors. ###@###.### 2005-07-20 16:20:57 GMT
|