2 using System
.Threading
;
3 using MonoTests
.Helpers
;
5 [AttributeUsage(AttributeTargets
.Field
)]
6 public sealed class Weak2Attribute
: Attribute
10 public class Finalizable
{
14 Console
.WriteLine ("Finalized. {0}", a
);
18 public class OneField
{
23 static Finalizable retain
;
32 public Finalizable Obj4
;
34 public static int Main (String
[] args
) {
36 FinalizerHelpers
.PerformNoPinAction (delegate () {
37 FinalizerHelpers
.PerformNoPinAction (delegate () {
38 t
.Obj
= new Finalizable ();
39 t
.Obj2
= new Finalizable ();
40 t
.Obj3
= new Finalizable ();
41 t
.Obj4
= retain
= new Finalizable ();
46 GC
.WaitForPendingFinalizers ();
53 //overflow the nursery, make sure we fill it
54 for (int i
= 0; i
< 1000 * 1000 * 10; ++i
)
57 if (retain
.a
!= 0x1029458)
63 GC
.WaitForPendingFinalizers ();