1 18 package org.apache.batik.test; 19 20 import org.apache.batik.test.TestReport; 21 22 30 public class MemoryLeakTestValidator extends MemoryLeakTest { 31 public MemoryLeakTestValidator() { 32 } 33 34 Link start; 35 public TestReport doSomething() throws Exception { 36 for (int i=0; i<20; i++) 37 registerObjectDesc(new Object (), "Obj#"+i); 38 for (int i=0; i<10; i++) { 39 Pair p1 = new Pair(); 40 Pair p2 = new Pair(); 41 p1.mate(p2); 42 registerObjectDesc(p2, "Pair#"+i); 43 } 44 Link p = null; 45 for (int i=0; i<10; i++) { 46 p = new Link(p); 47 registerObjectDesc(p, "Link#"+i); 48 } 49 return null; 52 } 53 54 public static class Pair { 55 Pair myMate; 56 public Pair() { } 57 public void mate(Pair p) { 58 this.myMate = p; 59 p.myMate = this; 60 } 61 } 62 63 public static class Link { 64 public Link prev; 65 public Link(Link prev) { 66 this.prev = prev; 67 } 68 } 69 70 } 71 | Popular Tags |