// A basic test for GCed memory allocation class Test1 { public static single void main(String single[] args) throws RegionInUse { int total = 0; int k; try { k = Integer.parseInt(args[0]); } catch (Exception e) { }; int single iters = (int single)k; for (int single n = iters; n > 0; n--) { IList lst = null; SharedRegion single r = new SharedRegion(); int k, l; try { k = Integer.parseInt(args[1]); l = Integer.parseInt(args[2]); } catch (Exception e) { k = l = 1; } 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); } }