
using System;
using System.Diagnostics;
namespace Action
{
class Program
{
static void Main(string[] args)
{
GC.Collect();//清理一下先
Random ra = new Random();
int count = 1000000;//100W
DateTime start = DateTime.Now;
for (int i = 0; i < count; i++)
{
new String(""+i);
}
DateTime end = DateTime.Now;
double usedMemory = Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0;
Console.WriteLine("耗时:" + (end - start).TotalMilliseconds + "毫秒");
Console.WriteLine("消耗内存:" + usedMemory + "M");
}
}
}