Example #1
0
        public DoubLink(int Num, bool large)
        {
            Mv_DLink = new DLinkNode[Num];

            if (Num == 0)
            {
                return;
            }

            if (Num == 1)
            {
                // only one element
                Mv_DLink[0] = new DLinkNode((large ? 256 : 1), Mv_DLink[0], Mv_DLink[0]);
                return;
            }

            // first element
            Mv_DLink[0] = new DLinkNode((large ? 256 : 1), Mv_DLink[Num - 1], Mv_DLink[1]);

            // all elements in between
            for (int i = 1; i < Num - 1; i++)
            {
                Mv_DLink[i] = new DLinkNode((large ? 256 : i + 1), Mv_DLink[i - 1], Mv_DLink[i + 1]);
            }

            // last element
            Mv_DLink[Num - 1] = new DLinkNode((large ? 256 : Num), Mv_DLink[Num - 2], Mv_DLink[0]);
        }
Example #2
0
 public DLinkNode(int SizeNum, DLinkNode LastObject, DLinkNode NextObject)
 {
     Last = LastObject;
     Next = NextObject;
     Size = new int[SizeNum * 1024];
     Size[0] = 1;
     Size[SizeNum * 1024 - 1] = 2;
 }
Example #3
0
        public bool runTest(int iRep, int iObj, int iNum)
        {
            DoubLink  L_Node1 = new DoubLink(iNum);
            DLinkNode L_Node2 = new DLinkNode(iNum, null, null);

            for (int i = 0; i < iRep; i++)
            {
                G_Vart = new Object[iObj];
                for (int j = 0; j < iObj; j++)
                {
                    if (j % 2 == 1)
                    {
                        G_Vart[j] = (L_Node1);
                    }
                    else
                    {
                        G_Vart[j] = (L_Node2);
                    }
                }
                MakeLeak(iRep, iObj, iNum);
            }
            return(true);
        }
Example #4
0
        public bool runTest(int iRep, int iObj, int iNum)
        {
            DoubLink L_Node1 = new DoubLink(iNum);
            DLinkNode L_Node2 = new DLinkNode(iNum, null, null);

            for (int i = 0; i < iRep; i++)
            {
                G_Vart = new Object[iObj];
                for (int j = 0; j < iObj; j++)
                {
                    if (j % 2 == 1)
                        G_Vart[j] = (L_Node1);
                    else
                        G_Vart[j] = (L_Node2);
                }
                MakeLeak(iRep, iObj, iNum);
            }
            return true;
        }
Example #5
0
        public void MakeLeak(int iRep, int iObj, int iNum)
        {
            DoubLink L_Node1 = new DoubLink(iNum);
            DLinkNode L_Node2 = new DLinkNode(iNum, null, null);
            Object[] L_Vart1 = new Object[iObj];
            Object[] L_Vart2;

            for (int i = 0; i < iRep; i++)
            {
                L_Vart2 = new Object[iObj];
                for (int j = 0; j < iObj; j++)
                {
                    if (j % 2 == 1)
                    {
                        L_Vart1[j] = (j);
                        L_Vart2[j] = ((double)j);
                    }
                    else
                    {
                        L_Vart2[j] = (L_Node2);
                        L_Vart1[j] = (L_Node1);
                    }
                }
            }
        }