Beispiel #1
0
            public bool RunTest()
            {
                obj = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();

                Console.Write(BNode.icFinalNode); 
                Console.WriteLine(" Nodes were finalized and resurrected.");

                for (int i = 0; i < BNode.rlNodeCount; i++)
                {
                    BNode oldNode = (BNode)BNode.rlNode[i];
                    if ( oldNode.mem[0] != 99 )
                    {
                        Console.WriteLine( "One Node is not resurrected correctly.");
                    }
                    oldNode = null;
                    BNode.rlNode[ i ] = null;
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();

                return ( BNode.icCreateNode == BNode.icFinalNode );

            }
Beispiel #2
0
        public void DeleteObj(int iObj,int iSwitch)
        {
            for( int i= 0; i< iObj; i++ )
            {
                rgNode[i] = new BNode( i+1 );
                alWeakRef.Add( new WeakReference( rgNode[i], (iSwitch == 1) ) );
            }

            GC.Collect();
            for( int i=0; i< iObj; i++)
            {
                if ( (alWeakRef[ i ]).Target == null )
                {
                    //*all weakref have strong reference, so it should not return null
                    bret = false;
                }
            }

            for( int i=0; i< iObj; i++)
            {
                rgNode[i] = null;
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

        }
Beispiel #3
0
#pragma warning restore 0414
            public CreateObj()
            {
                Continue mv_Obj = new Continue();

                for( int i=1; i< 1000; i++)
                {
                    obj = new BNode(i); //create new one and delete the last one.
                    mv_Obj.CreateNode( i ); //create locate objects in createNode().
                }

                Console.Write(BNode.icCreateNode); 
                Console.WriteLine(" Nodes were created.");
            }
Beispiel #4
0
 public void CreateNode( int i )
 {
     BNode rgobj = new BNode( i );
 }
Beispiel #5
0
 public void CreateNode(int i)
 {
     BNode rgobj = new BNode(i);
 }
Beispiel #6
0
 public void DestroyNode()
 {
     obj = null;
 }
Beispiel #7
0
#pragma warning restore 0414


        public CreateObj()
        {

            mv_Obj = new BaseFinal();
            //Printing GetTotalMemory is commented out so that the test can build on RedHawk
            //Console.WriteLine("before test started, the heapsize is {0}", GC.GetTotalMemory(false));

            for( int i=1; i< 1000; i++)
            {
                obj = new BNode(i);     //create new one and delete the last one.
                mv_Obj.CreateNode( i ); //create locate objects in createNode().
            }
            Console.Write(BNode.icCreateNode);
             Console.WriteLine(" Nodes were created.");

            //Console.WriteLine("after all objects were created, the heapsize is " + GC.GetTotalMemory(false));
        }
Beispiel #8
0
        public bool RunTest()
        {
            obj = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            Console.Write(BNode.icFinalNode);
            Console.WriteLine(" Nodes were finalized and resurrected.");
            //Console.WriteLine("after all objects were deleted and resurrected in Finalize() , the heapsize is " + GC.GetTotalMemory(false));

            for(int i=0; i< BNode.rlNode.Count; i++)
            {
                BNode oldNode = (BNode)BNode.rlNode[ i ];
                if ( oldNode.mem[0] != 99 )
                {
                    Console.WriteLine( "One Node is not resurrected correctly.");
                }
                oldNode = null;
                BNode.rlNode[ i ] = null;
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            //Console.WriteLine("after all objects were deleted , the heapsize is " + GC.GetTotalMemory(false));

            return ( BNode.icCreateNode == BNode.icFinalNode );


        }
Beispiel #9
0
 public void DestroyObj()
 {
     obj = null;
 }