// Simple test for region based allocation (allocates lots of objects) class Test1 { public static void main(String[] args) throws RegionInUse { int total = 0; int iters = Integer.parseInt(args[0]); for (int n = iters; n > 0; n--) { IList lst = null; PrivateRegion r = new PrivateRegion(); int k = Integer.parseInt(args[1]); int l = Integer.parseInt(args[2]); for (int i = 0; i < l; i++) lst = new (r) IList(k, lst); total += lst.sum(); r.delete(); } System.out.println(args[0] + " x " + args[1] + " x " + args[2] + " = " + total); } } class IList { private IList cdr; private int car; IList(int pcar, IList pcdr) { cdr = pcdr; car = pcar; } int car() { return car; } IList cdr() { return cdr; } int sum() { return car + (cdr != null ? cdr.sum() : 0); } }