import java.util.*; public class checkmem { public static void outputmem(int i) { System.out.println(i + "task usedMemory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())); } public static final int MB = 1048576; public static boolean single foo = false; public static void main(String[]args) { System.out.println("startup:"); outputmem(0); PrivateRegion r = new PrivateRegion(); //Stack s = new (r) Stack(); int sz = 1*MB; if (args.length > 0) try { sz = Integer.parseInt(args[0]); } catch(Throwable exn) {} int interval = 1*MB/sz; if (interval<1)interval=1; System.out.println("Running memory grab test with chunk size = " + sz); for (int single i=0; ; i++) { //s.push(new (r) byte[sz]); byte[]a = new (r) byte[sz]; if (Ti.thisProc() == 0 && i%interval==0) outputmem(i); Ti.barrier(); } /* System.out.println("task totalMemory = " + Runtime.getRuntime().totalMemory()); System.out.println("task freeMemory = " + Runtime.getRuntime().freeMemory()); System.out.println("task usedMemory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())); try{r.delete();} catch(Throwable exn) {} System.out.println("task totalMemory = " + Runtime.getRuntime().totalMemory()); System.out.println("task freeMemory = " + Runtime.getRuntime().freeMemory()); System.out.println("task usedMemory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())); */ }}