Пример #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.");
        }

        SuppressFinalizeTest test = new SuppressFinalizeTest(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 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.");
        }

        SuppressFinalizeTest test = new SuppressFinalizeTest(sizeInMB);

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

        Console.WriteLine("Test failed");
        return 0;
    }
Пример #3
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;
        }


        SuppressFinalizeTest test = new SuppressFinalizeTest(size);

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

        Console.WriteLine("Test failed");
        return(0);
    }
Пример #4
0
    public static int Main(string[] args)
    {
        SuppressFinalizeTest test = new SuppressFinalizeTest(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;
        }


        SuppressFinalizeTest test = new SuppressFinalizeTest(size);

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

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