Esempio n. 1
0
        static void Main(string[] args)
        {
            var captain = new SamurayCaptain();

            MemoryLeakVersion(captain);
            //FixedVersion(captain);
        }
Esempio n. 2
0
 private static void MemoryLeakVersion(SamurayCaptain captain)
 {
     for (int i = 0; i < 20000; i++)
     {
         var s = new Samuray(captain, "Samuray_" + i);
     }
 }
Esempio n. 3
0
 private static void FixedVersion(SamurayCaptain captain)
 {
     for (int i = 0; i < 20000; i++)
     {
         using (var s = new Samuray(captain, "Samuray_" + i))
         {
         }
     }
 }
Esempio n. 4
0
 public Samuray(SamurayCaptain samurayCaptain, string name)
 {
     samurayCaptain.CommandGived += OnCommandGived;
     this.samurayCaptain          = samurayCaptain;
     this.name = name;
 }