/* * Benchmark.java * * Created on October 3, 2002, 3:30 PM */ package is27.e563; import org.openide.cookies.EditorCookie; import org.openide.filesystems.FileObject; import org.openide.filesystems.Repository; import org.openide.loaders.DataObject; /** * * @author pk97937 */ public class Benchmark { /** Creates a new instance of Benchmark */ public Benchmark() { } /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { FileObject fo = Repository.getDefault().findResource("is27/e563/Benchmark.java"); DataObject dobj = DataObject.find(fo); EditorCookie editor = (EditorCookie) dobj.getCookie(EditorCookie.class); for (int i = 5; i>0; i--) { System.gc(); } long free = Runtime.getRuntime().freeMemory(); long total = Runtime.getRuntime().totalMemory(); System.err.println("Free " + free + " of " + total); for (int i = 0; i<100; i++) { editor.open(); editor.close(); } for (int i = 5; i>0; i--) { System.gc(); } long free2 = Runtime.getRuntime().freeMemory(); long total2 = Runtime.getRuntime().totalMemory(); System.err.println("Free " + free2 + " of " + total2); System.err.println("Memory leak " + (total2 - total + free - free2)); } }