88 rw = new WeakReference(s, q);
89 rw2 = new WeakReference(s);
90 rp = new PhantomReference(s, q);
91 rp2 = new PhantomReference(s.sub, q);
92 s = null;
93 }
94 });
95
96 showReferences();
97
98 int ndq = 0;
99 boolean prevFinalized = false;
100 outer:
101 for (int i = 1;; i++) {
102 Reference r;
103
104 createNoise();
105 System.err.println("GC " + i);
106 Thread.sleep(10);
107 System.gc();
108
109 showReferences();
110 while ((r = q2.poll()) != null) {
111 System.err.println("Noise " + r);
112 }
113
114 /* Cause a dummy object to be finalized, since the finalizer thread
115 might retain a reference to the Basic instance after it's been
116 finalized (this happens with java_g) */
117 if (Basic.finalized && !prevFinalized) {
118 fork(new Runnable() {
119 public void run() {
120 new ClearFinalizerThread();
121 }});
122 prevFinalized = true;
123 }
124
125 while ((r = q.poll()) != null) {
126 ndq++;
127 if (r != null) {
|
88 rw = new WeakReference(s, q);
89 rw2 = new WeakReference(s);
90 rp = new PhantomReference(s, q);
91 rp2 = new PhantomReference(s.sub, q);
92 s = null;
93 }
94 });
95
96 showReferences();
97
98 int ndq = 0;
99 boolean prevFinalized = false;
100 outer:
101 for (int i = 1;; i++) {
102 Reference r;
103
104 createNoise();
105 System.err.println("GC " + i);
106 Thread.sleep(10);
107 System.gc();
108 System.runFinalization();
109
110 showReferences();
111 while ((r = q2.poll()) != null) {
112 System.err.println("Noise " + r);
113 }
114
115 /* Cause a dummy object to be finalized, since the finalizer thread
116 might retain a reference to the Basic instance after it's been
117 finalized (this happens with java_g) */
118 if (Basic.finalized && !prevFinalized) {
119 fork(new Runnable() {
120 public void run() {
121 new ClearFinalizerThread();
122 }});
123 prevFinalized = true;
124 }
125
126 while ((r = q.poll()) != null) {
127 ndq++;
128 if (r != null) {
|