Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyCls
- {
- public int Data;
- }
- class Program
- {
- const int m_ArrSize = 299999999;
- //const int m_ArrSize = 50000000;
- static long GetTickMS()
- {
- return DateTime.Now.Ticks / 10000;
- }
- static void Main(string[] args)
- {
- Console.WriteLine("Start");
- Random random = new Random();
- MyCls[] arr = new MyCls[m_ArrSize];
- long maxDelay = 0;
- long startTick = GetTickMS();
- long level = 100;
- for (; ; )
- {
- int[] pos = new int[] { random.Next(m_ArrSize), random.Next(m_ArrSize), random.Next(m_ArrSize) };
- for (int i = 0; i < 3; i++)
- {
- int idx = random.Next(3);
- arr[pos[idx]] = new MyCls();
- }
- for (int idx = 0; idx < 3; idx++)
- arr[pos[idx]] = null;
- long delayTick = GetTickMS() - startTick;
- maxDelay = Math.Max(maxDelay, delayTick);
- if (maxDelay > level)
- {
- Console.WriteLine("GC Pause Delay: {0}MS, level: {1}", maxDelay, level);
- level += 100;
- }
- startTick = GetTickMS();
- }
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement