예제 #1
0
        public static int Main()
        {
            int         loop = 0;
            LargeObject largeobj;

            Console.WriteLine("Test should pass with ExitCode 100\n");

            while (loop <= 200)
            {
                loop++;
                Console.Write("LOOP: {0}\n", loop);
                try
                {
                    largeobj = new LargeObject();
                    Console.WriteLine("Allocated LargeObject");
                }
                catch (Exception e)
                {
                    Console.WriteLine("Failure to allocate at loop {0}\n", loop);
                    Console.WriteLine("Caught Exception: {0}", e);
                    return(ExitCode);
                }
                largeobj = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
                Console.WriteLine("LargeObject Collected\n");
            }
            Console.WriteLine("Test Passed");
            GC.Collect();

            return(ExitCode);
        }
예제 #2
0
        public static int Main()
        {
            int loop = 0;
            LargeObject largeobj;

            TestLibrary.Logging.WriteLine("Test should pass with ExitCode 100\n");


            while (loop <= 200)
            {
                loop++;
                TestLibrary.Logging.Write(String.Format("LOOP: {0}\n", loop));
                try
                {
                    largeobj = new LargeObject();
                    TestLibrary.Logging.WriteLine("Allocated LargeObject");
                }
                catch (Exception e)
                {
                    TestLibrary.Logging.WriteLine("Failure to allocate at loop {0}\n", loop);
                    TestLibrary.Logging.WriteLine("Caught Exception: {0}", e);
                    return 1;
                }
                largeobj = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
                TestLibrary.Logging.WriteLine("LargeObject Collected\n");
            }
            TestLibrary.Logging.WriteLine("Test Passed");
            GC.Collect();

            return ExitCode;
        }
	public static void Main() {
		int loop = 0;
		LargeObject largeobj;

		Console.WriteLine("Test should pass with ExitCode 0\n");
		Environment.ExitCode=1;
		
		while(loop<=200) {
		  	loop++;
		  	Console.Write("LOOP: {0}\n",loop);
			try {
			   largeobj=new LargeObject();
			   Console.WriteLine("Allocated LargeObject");
			}catch (Exception e) {
			    Console.WriteLine("Failure to allocate at loop {0}\n",loop);
			    Console.WriteLine("Caught Exception: {0}",e);
			    return;
			 }
		largeobj=null;
		GC.Collect();
		GC.WaitForPendingFinalizers();
		Console.WriteLine("LargeObject Collected\n");
		}
		Console.WriteLine("Test Passed");
		GC.Collect();
	}
예제 #4
0
	public static void Main() {
		int size = 1;
		int loop=1;
		LargeObject largeobj;

		
		Console.WriteLine("Test should pass with ExitCode 0\n");
		Environment.ExitCode=1;
		
		while(loop<100) {
		Console.WriteLine("Loop: {0}",loop);
		for(int i=0;i<=7;i++) {
		
		try {
		   largeobj=new LargeObject(size);
		   Console.WriteLine("Allocated LargeObject: {0} bytes",size*4*1024*50);
		}catch (Exception e) {
		    Console.WriteLine("Failure to allocate in loop {0}\n",loop);
		    Console.WriteLine("Caught Exception: {0}",e);
		    return;
		 }
		largeobj=null;
		GC.Collect();
		GC.Collect();
		Console.WriteLine("LargeObject Collected");
		size*=2;
                }
		size=1;
		loop++;
		}
		
		Console.WriteLine("Test Passed");
		GC.Collect();
	}
예제 #5
0
        public static bool AllocAndCollect(int loop)
        {
            LargeObject largeobj;

            try
            {
                largeobj = new LargeObject();
                TestLibrary.Logging.WriteLine("Allocated LargeObject");
            }
            catch (Exception e)
            {
                TestLibrary.Logging.WriteLine("Failure to allocate at loop {0}\n", loop);
                TestLibrary.Logging.WriteLine("Caught Exception: {0}", e);
                return(false);
            }

            largeobj = null;
            return(true);
        }
예제 #6
0
        public static int Main(string[] args)
        {
            int         size = 1;
            int         loop = 1;
            LargeObject largeobj;


            TestLibrary.Logging.WriteLine("Test should pass with ExitCode 100\n");


            while (loop < 100)
            {
                TestLibrary.Logging.WriteLine("Loop: {0}", loop);
                for (int i = 0; i <= 7; i++)
                {
                    try
                    {
                        largeobj = new LargeObject(size);
                        TestLibrary.Logging.WriteLine("Allocated LargeObject: {0} bytes", size * 4 * 1024 * 50);
                    }
                    catch (Exception e)
                    {
                        TestLibrary.Logging.WriteLine("Failure to allocate in loop {0}\n", loop);
                        TestLibrary.Logging.WriteLine("Caught Exception: {0}", e);
                        return(1);
                    }
                    largeobj = null;
                    GC.Collect();
                    GC.Collect();
                    TestLibrary.Logging.WriteLine("LargeObject Collected");
                    size *= 2;
                }
                size = 1;
                loop++;
            }

            TestLibrary.Logging.WriteLine("Test Passed");
            GC.Collect();

            return(ExitCode);
        }
예제 #7
0
        public static int Main()
        {
            int size = 1;
            int loop = 1;
            LargeObject largeobj;


            TestLibrary.Logging.WriteLine("Test should pass with ExitCode 100\n");


            while (loop < 100)
            {
                TestLibrary.Logging.WriteLine("Loop: {0}", loop);
                for (int i = 0; i <= 7; i++)
                {
                    try
                    {
                        largeobj = new LargeObject(size);
                        TestLibrary.Logging.WriteLine("Allocated LargeObject: {0} bytes", size * 4 * 1024 * 50);
                    }
                    catch (Exception e)
                    {
                        TestLibrary.Logging.WriteLine("Failure to allocate in loop {0}\n", loop);
                        TestLibrary.Logging.WriteLine("Caught Exception: {0}", e);
                        return 1;
                    }
                    largeobj = null;
                    GC.Collect();
                    GC.Collect();
                    TestLibrary.Logging.WriteLine("LargeObject Collected");
                    size *= 2;
                }
                size = 1;
                loop++;
            }

            TestLibrary.Logging.WriteLine("Test Passed");
            GC.Collect();

            return ExitCode;
        }
예제 #8
0
        public static void Main()
        {
            int         size = 1;
            int         loop = 1;
            LargeObject largeobj;


            Console.WriteLine("Test should pass with ExitCode 0\n");
            Environment.ExitCode = 1;

            while (loop < 100)
            {
                Console.WriteLine("Loop: {0}", loop);
                for (int i = 0; i <= 7; i++)
                {
                    try {
                        largeobj = new LargeObject(size);
                        Console.WriteLine("Allocated LargeObject: {0} bytes", size * 4 * 1024 * 50);
                    }catch (Exception e) {
                        Console.WriteLine("Failure to allocate in loop {0}\n", loop);
                        Console.WriteLine("Caught Exception: {0}", e);
                        return;
                    }
                    largeobj = null;
                    GC.Collect();
                    GC.Collect();
                    Console.WriteLine("LargeObject Collected");
                    size *= 2;
                }
                size = 1;
                loop++;
            }

            Console.WriteLine("Test Passed");
            GC.Collect();
        }