X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FOOMWarning.java;h=2195fb23fadd1dd35ff59502fa98b3f0483e7515;hb=797df64fa2a0a30773d0f48f5494d4155e5a8be3;hp=3f2b5a8f058657d6e7c1aaec7bed12934e4e281b;hpb=d423f22792e47dbc800ae220a58677f988971d06;p=jalview.git diff --git a/src/jalview/gui/OOMWarning.java b/src/jalview/gui/OOMWarning.java index 3f2b5a8..2195fb2 100644 --- a/src/jalview/gui/OOMWarning.java +++ b/src/jalview/gui/OOMWarning.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -25,6 +25,8 @@ public class OOMWarning implements Runnable String instructions = ""; + public static boolean oomInprogress = false; + Component desktop = null; /** @@ -40,22 +42,27 @@ public class OOMWarning implements Runnable OOMWarning(final String action, final OutOfMemoryError oomex, final Component instance) { - this.action = action; - desktop = instance; - if (oomex != null) + if (!oomInprogress) { - if (jalview.bin.Cache.log != null) - { - jalview.bin.Cache.log.error("Out of Memory when " + action, oomex); - } - else + oomInprogress = true; + this.action = action; + desktop = instance; + if (oomex != null) { - System.err.println("Out of Memory when " + action); - oomex.printStackTrace(); + if (jalview.bin.Cache.log != null) + { + jalview.bin.Cache.log + .error("Out of Memory when " + action, oomex); + } + else + { + System.err.println("Out of Memory when " + action); + oomex.printStackTrace(); + } } + javax.swing.SwingUtilities.invokeLater(this); + System.gc(); } - javax.swing.SwingUtilities.invokeLater(this); - System.gc(); } public OOMWarning(String string, OutOfMemoryError oomerror) @@ -74,6 +81,8 @@ public class OOMWarning implements Runnable + "\nSee help files for increasing Java Virtual Machine memory.", "Out of memory", javax.swing.JOptionPane.WARNING_MESSAGE); + // hope that there's enough memory left that no more appear. + oomInprogress = false; } }