Java web start app crashes with OutOfMemoryError
I have extended a genomics viewer with some features requested by the Johns Hopkins Lab. When I run the 开发者_如何学运维app from the command-line I seem to have no memory problems - the app has been started with -Xmx750m. However, when I run the same app as a web-start app with the following heap settings:
<java initial-heap-size="67108864" max-heap-size="1205862400" version="1.5+"/>
after a while the app crashes with an OutOfMemoryError thus:
ERROR [2011-01-12 16:28:22,437] [DefaultExceptionHandler.java:42] [AWT-EventQueue-0] Unhandled exception
java.lang.OutOfMemoryError
at java.util.zip.Inflater.init(Native Method)
at java.util.zip.Inflater.<init>(Unknown Source)
at java.util.zip.Inflater.<init>(Unknown Source)
There is no difference between the local app and web-start app except that I have signed the jars which are called out in the web-start jnlp file. I have tried to attach to the web-start app with both JConsole and YourKit Java profiler. In each case, I have turned on the HeapDumpOnOutOfMemoryError property by invoking the setVMOption operation of the HotSpotDiagnostic MBean; but when the app crashes, no heap dump is generated.
It seems to me that the crash is related to running under web-start. I have tried very hard to cause an OutOfMemoryError on the desktop app - by reducing the memory (-Xmx250m); this causes the app to pause for long periods of time (as much as 5min) while presumably garbage collection is done. But the app always resumes after the pause - never crashes.
Can anyone tell me of a way to capture a heap-dump on an OutOfMemoryError under web-start? Though, I suspect that I may not be actually running out of heap at all. But at least it would be a place to start.
I am at my wit's end - any help would be greatly appreciated.
I am running Java 1.6.0_20-b02 on Windows XP-SP2.
I also saw this in my app. In my case it was caused by corrupted JARs. Try if the signed jars are still valid (try opening them in winzip or other zip tool - my favourite is CTRL+PGDOWN in TotalCommander ;-)
I just fixed a very similar issue yesterday which I resolved by calling Deflater.end()
(see this for some extra info). I was getting OutOfMemoryError exceptions during serialization, but for some reason only when deployed as a webstart -- I couldn't duplicate the problem in Eclipse or in an executable jar regardless of Xmx.
精彩评论