コード例 #1
0
        public static int Main(string[] args)
        {
            int iDim1 = 100;
            int iDim2 = 100;
            int iRep  = 30;

            Console.WriteLine("Test should return with ExitCode 100 ...");

            MulDimJagAry mv_Obj = new MulDimJagAry();

            int[][] iJag;
            for (int j = 0; j < iRep; j++)
            {
                iJag = new int[iDim1][];
                for (int i = 0; i < iDim2; i++)
                {
                    iJag[i] = new int[i];
                    if (i >= 1)
                    {
                        iJag[i][0]     = 0;
                        iJag[i][i - 1] = i;
                    }
                }
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }

            Object[][] oJag;
            for (int j = 0; j < iRep; j++)
            {
                oJag = new Object[iDim1][];
                for (int i = 0; i < iDim1; i++)
                {
                    oJag[i] = new Object[i];
                    if (i >= 1)
                    {
                        oJag[i][0]     = (0);
                        oJag[i][i - 1] = new long[i];
                    }
                }
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }

            Object[][][] oJag3 = new Object[iDim1][][];
            oJag3[3] = new Object[iDim2][];
            oJag3[4] = new Object[iDim2][];
            for (int i = 0; i < iDim2; i++)
            {
                oJag3[4][i] = new Object[iDim1];
            }

            for (int j = 0; j < iRep; j++)
            {
                oJag3 = new Object[iDim1][][];
                for (int i = 0; i < iDim1; i++)
                {
                    oJag3[i] = new Object[iDim2][];
                    for (int k = 0; k < iDim2; k++)
                    {
                        oJag3[i][k] = new Object[k];
                        for (int l = 0; l < k; l++)
                        {
                            if (l >= 1)
                            {
                                oJag3[i][k][0]     = (0);
                                oJag3[i][k][l - 1] = new long[l];
                            }
                        }
                    }
                }
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }

            for (int j = 0; j < iRep; j++)
            {
                oJag3 = new Object[iDim1][][];
                mv_Obj.SetThreeDimJagAry(oJag3, iDim1, iDim2);
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }


            Object[][][] vJag;
            for (int j = 0; j < iRep; j++)
            {
                vJag = new Object[iDim1][][];
                mv_Obj.SetThreeDimJagVarAry(vJag, iDim1, iDim2);
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }


            return(100);
        }
コード例 #2
0
ファイル: MulDimJagAry.cs プロジェクト: enavro/coreclr
        public static int Main(String []args)
        {
            int iDim1 = 100;
            int iDim2 = 100;
            int iRep = 30;
            Console.WriteLine("Test should return with ExitCode 100 ...");

            MulDimJagAry mv_Obj = new MulDimJagAry();

            int [][] iJag;
            for(int j=0; j<iRep; j++ )
            {
                iJag = new int[iDim1][];
                for( int i=0; i< iDim2; i++ )
                {
                    iJag[i] = new int[i];
                    if( i>= 1 )
                    {
                        iJag[i][0] = 0;
                        iJag[i][i-1] = i;
                    }
                }
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }

            Object[][] oJag;
            for(int j=0; j<iRep; j++ )
            {
                oJag = new Object[iDim1][];
                for( int i=0; i< iDim1; i++ )
                {
                    oJag[i] = new Object[i];
                    if( i>= 1 )
                    {
                        oJag[i][0] = (0);
                        oJag[i][i-1] = new long[i];
                    }

                }
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }

            Object[][][] oJag3 = new Object[iDim1][][];
            oJag3[3] = new Object[iDim2][];
            oJag3[4] = new Object[iDim2][];
            for (int i = 0; i < iDim2; i ++)
            {
                oJag3[4][i] = new Object[iDim1];
            }

            for(int j=0; j<iRep; j++ )
            {
                oJag3 = new Object[iDim1][][];
                for( int i=0; i< iDim1; i++ )
                {
                    oJag3[i] = new Object[iDim2][];
                    for(int k=0; k<iDim2; k++)
                    {
                        oJag3[i][k] = new Object[k];
                        for(int l = 0; l< k; l++ )
                        {
                            if( l>= 1 )
                            {
                                oJag3[i][k][0] = (0);
                                oJag3[i][k][l-1] = new long[l];
                            }
                        }
                    }

                }
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }

            for(int j=0; j<iRep; j++ )
            {
                oJag3 = new Object[iDim1][][];
                mv_Obj.SetThreeDimJagAry( oJag3, iDim1, iDim2 );
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }


            Object[][][] vJag;
            for(int j=0; j<iRep; j++ )
            {
                vJag = new Object[iDim1][][];
                mv_Obj.SetThreeDimJagVarAry( vJag, iDim1, iDim2 );
                //if( GC.GetTotalMemory(false) >= 1024*1024*6 )
                //{
                //    Console.WriteLine( "HeapSize before GC: "+ GC.GetTotalMemory(false) );
                //    GC.Collect();
                //    Console.WriteLine( "HeapSize after GC: "+ GC.GetTotalMemory(false) );
                //}
            }


            return 100;

        }