From: kiramt Date: Tue, 29 Aug 2017 09:48:54 +0000 (+0100) Subject: JAL-2665 OOM check X-Git-Tag: Release_2_10_3b1~140^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9fbe0b7db00341a5b0707731ecb7c5ea3254b9b4;p=jalview.git JAL-2665 OOM check --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 8004cac..f34ab2c 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -453,8 +453,20 @@ public class SeqCanvas extends JComponent implements ViewportListenerI int canvasHeight, int startRes) { SequenceGroup group = av.getSelectionGroup(); - BufferedImage selectImage = new BufferedImage(canvasWidth, canvasHeight, - BufferedImage.TYPE_INT_ARGB); // ARGB so alpha compositing works + BufferedImage selectImage = null; + + try + { + selectImage = new BufferedImage(canvasWidth, canvasHeight, + BufferedImage.TYPE_INT_ARGB); // ARGB so alpha compositing works + } catch (OutOfMemoryError er) + { + System.gc(); + System.err.println("Print image OutOfMemory Error.\n" + er); + new OOMWarning("Creating wrapped alignment image for printing", er); + + return; + } if (group != null) {