X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FOOMWarning.java;h=48db5d91919f7340fa30d1c4bd8358e60627ce03;hb=acb5aa4d23f04663b566940d67ae5bfeb549ba98;hp=3f2b5a8f058657d6e7c1aaec7bed12934e4e281b;hpb=d423f22792e47dbc800ae220a58677f988971d06;p=jalview.git diff --git a/src/jalview/gui/OOMWarning.java b/src/jalview/gui/OOMWarning.java index 3f2b5a8..48db5d9 100644 --- a/src/jalview/gui/OOMWarning.java +++ b/src/jalview/gui/OOMWarning.java @@ -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; } }