// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. /****************************************************************** /*Test case for testing GC with cyclic single linked list leaks /*In every loop. SetLink() to create a SingLink object array whose size /*is iRep, each SingLink Object is a iObj node cyclic single /*linked list. MakeLeak() deletes all the object reference in the array /*to make all the cyclic single linked lists become memory leaks. /******************************************************************/ namespace SingLink { using System; public class SingLinkStay { internal SingLink []Mv_Sing; public static int Main(System.String [] Args) { int iRep = 0; int iObj = 0; Console.WriteLine("Test should return with ExitCode 100 ..."); switch( Args.Length ) { case 1: if (!Int32.TryParse( Args[0], out iRep )) { iRep = 100; } break; case 2: if (!Int32.TryParse( Args[0], out iRep )) { iRep = 100; } if (!Int32.TryParse( Args[1], out iObj )) { iObj = 10; } break; default: iRep = 100; iObj = 10; break; } SingLinkStay Mv_Leak = new SingLinkStay(); if(Mv_Leak.runTest(iRep, iObj )) { Console.WriteLine( "Test Passed" ); return 100; } else { Console.WriteLine( "Test Failed" ); return 1; } } public bool runTest(int iRep, int iObj) { for(int i=0; i<20; i++) { SetLink(iRep, iObj); MakeLeak(iRep); } return true; } public void SetLink(int iRep, int iObj) { Mv_Sing = new SingLink[iRep]; for(int i=0; i