コード例 #1
0
    public static int Main(string[] args) {

        uint sizeInMB = 0;
        try {
           sizeInMB = UInt32.Parse(args[0]);
        } catch (Exception e) {
           if ( (e is IndexOutOfRangeException) || (e is FormatException) || (e is OverflowException) ) {
               Console.WriteLine("args: uint - number of MB to allocate");
               return 0;
           }
           throw;
        }

        int availableMem = MemCheck.GetPhysicalMem();
        if (availableMem != -1 && availableMem < sizeInMB){
            sizeInMB = (uint)(availableMem > 300 ? 300 : (availableMem / 2));
            Console.WriteLine("Not enough memory. Allocating " + sizeInMB + "MB instead.");
        }

        ReRegisterForFinalizeTest test = new ReRegisterForFinalizeTest(sizeInMB);

        if (test.RunTests()) {
            Console.WriteLine("Test passed");
            return 100;
        }

        Console.WriteLine("Test failed");
        return 0;
    }
コード例 #2
0
    public static int Main(string[] args)
    {
        uint size = 0;

        try {
            size = UInt32.Parse(args[0]);
        } catch (Exception e) {
            if ((e is IndexOutOfRangeException) || (e is FormatException) || (e is OverflowException))
            {
                Console.WriteLine("args: uint - number of GB to allocate");
                return(0);
            }
            throw;
        }


        ReRegisterForFinalizeTest test = new ReRegisterForFinalizeTest(size);

        if (test.RunTests())
        {
            Console.WriteLine("Test passed");
            return(100);
        }

        Console.WriteLine("Test failed");
        return(0);
    }
コード例 #3
0
    public static int Main(string[] args)
    {
        uint sizeInMB = 0;

        try {
            sizeInMB = UInt32.Parse(args[0]);
        } catch (Exception e) {
            if ((e is IndexOutOfRangeException) || (e is FormatException) || (e is OverflowException))
            {
                Console.WriteLine("args: uint - number of MB to allocate");
                return(0);
            }
            throw;
        }

        int availableMem = MemCheck.GetPhysicalMem();

        if (availableMem != -1 && availableMem < sizeInMB)
        {
            sizeInMB = (uint)(availableMem > 300 ? 300 : (availableMem / 2));
            Console.WriteLine("Not enough memory. Allocating " + sizeInMB + "MB instead.");
        }

        ReRegisterForFinalizeTest test = new ReRegisterForFinalizeTest(sizeInMB);

        if (test.RunTests())
        {
            Console.WriteLine("Test passed");
            return(100);
        }

        Console.WriteLine("Test failed");
        return(0);
    }
コード例 #4
0
    public static int Main(string[] args)
    {
        ReRegisterForFinalizeTest test = new ReRegisterForFinalizeTest(MemCheck.ParseSizeMBAndLimitByAvailableMem(args));

        if (test.RunTests())
        {
            Console.WriteLine("Test passed");
            return(100);
        }

        Console.WriteLine("Test failed");
        return(0);
    }
コード例 #5
0
    public static int Main(string[] args) {

        uint size = 0;
        try {
           size = UInt32.Parse(args[0]);
        } catch (Exception e) {
           if ( (e is IndexOutOfRangeException) || (e is FormatException) || (e is OverflowException) ) {
               Console.WriteLine("args: uint - number of GB to allocate");
               return 0;
           }
           throw;
        }


        ReRegisterForFinalizeTest test = new ReRegisterForFinalizeTest(size);

        if (test.RunTests()) {
            Console.WriteLine("Test passed");
            return 100;
        }

        Console.WriteLine("Test failed");
        return 0;
    }