Dead thread
I have a Swing app where the user can re-size an image. If the user zooms in a few times the JVM quickly runs out of memory. The image sizing is done on the AWT event thread, but when an
There are a few possible solutions.
Edit: Naturally, as soon as I posted this I found a possible solution: http://www.javaspecialists.co.za/archive/Issue081.html and http://www.javaspecialists.co.za/archive/Issue089.html
OutOfMemoryError is thrown this thread dies and the user can't do anything (including closing the app) because GUI events are no longer handled.There are a few possible solutions.
- I could do the re-sizing on another thread, but the problem is still lurking: an uncaught exception in the event thread should still be handled gracefully.
- I could have a thread that polls to see if the event handler is alive and have that clean up, but this feels clunky.
- I've tried setting the system property
sun.awt.exception.handlerhaving read how this is supposed to handle exactly this problem, but it doesn't seem to work.
Edit: Naturally, as soon as I posted this I found a possible solution: http://www.javaspecialists.co.za/archive/Issue081.html and http://www.javaspecialists.co.za/archive/Issue089.html
