Class DebugMethods


  • public class DebugMethods
    extends java.lang.Object
    some small methods helpful during development, to wait before program ends to see object instance statistics, once just until return is pressed, once a loop in which one can force GC, see object statistics, etc. until one enters "x" to make the loop exit.
    • Constructor Summary

      Constructors 
      Constructor Description
      DebugMethods()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void doCleanupStuff​(boolean doSwingCleanup)
      It seems this is the sequence of things needed to achieve full garbage collection/cleanup of JFrame stuff (Java 1.4.2): GC and finalization, 2 dummy frames, do the SwingCleanup hack, and once again GC and finalization.
      static void waitReturn()
      prints out "PRESS RETURN TO CONTINUE", and after return is pressed, prints then "OK, continuing" and returns.
      static void waitReturnLoop​(boolean force)
      Repeatedly checks whether now all tracked objects are gone.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DebugMethods

        public DebugMethods()
    • Method Detail

      • doCleanupStuff

        public static void doCleanupStuff​(boolean doSwingCleanup)
        It seems this is the sequence of things needed to achieve full garbage collection/cleanup of JFrame stuff (Java 1.4.2): GC and finalization, 2 dummy frames, do the SwingCleanup hack, and once again GC and finalization.
        Parameters:
        doSwingCleanup - Whether to call the swingCleanup() method
      • waitReturn

        public static void waitReturn()
        prints out "PRESS RETURN TO CONTINUE", and after return is pressed, prints then "OK, continuing" and returns.
      • waitReturnLoop

        public static void waitReturnLoop​(boolean force)
        Repeatedly checks whether now all tracked objects are gone. Each round, does GC + finalize, and asks for input. For input "s", prints statistics. For input "x", exits the loop. Exits the loop also if all are gone. If from beginning on all are gone, does not even go into the loop.
        Parameters:
        force - Go into loop even if allGone already returns true at begin