JAL-1173 try to catch OOMs when loading annotation onto alignment (need JAL-1176...
[jalview.git] / src / jalview / gui / AlignFrame.java
index 97829d4..8396e6a 100755 (executable)
@@ -4976,6 +4976,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     {
       ex.printStackTrace();
     }
+    catch (OutOfMemoryError oom)
+    {
+      try {
+        System.gc();
+      } catch (Exception x){};
+      new OOMWarning("loading data "+(protocol!=null ? (protocol.equals(FormatAdapter.PASTE) ? "from clipboard." : "using "+protocol+" from "+file) : ".")+(format!=null ? "(parsing as '"+format+"' file)" :""), oom, Desktop.desktop);
+    }
   }
 
   @Override