/* Write your code in this method */ public void Run() { timer = Stopwatch.StartNew(); GC.PrintTime(0, timer); LargeObject lo; for (int i = 1; i <= 10000; i++) { lo = new LargeObject(10000); GC.PrintTime(i, timer); } }
/* Write your code in this method */ public void Run() { timer = Stopwatch.StartNew(); GC.PrintTime(0, timer); LargeObject[] lo = new LargeObject[10000]; for (int i = 1; i <= 10000; i++) { lo[i - 1] = new LargeObject(); if (i % 1000 == 0) { System.GC.Collect(0); } GC.PrintTime(i, timer); } }
/* Write your code in this method */ public void Run() { timer = Stopwatch.StartNew(); int count = 0; LargeObject[] objs = new LargeObject[10000]; for (int i = 0; i < 10000; i++) { objs[i] = new LargeObject(); GC.PrintTime(i, timer); count++; if (count == 1000) { System.GC.Collect(0); count = 0; } } System.GC.Collect(); }