Example #1
0
 public ComplexArray(ulong totalCapacityComplexStructs)
 {
     Debug.Assert(totalCapacityComplexStructs > 0);
     this.lightWeight = totalCapacityComplexStructs <= 1024UL * 1024UL;
     if (this.lightWeight)
     {
         ulong stripeCount = (totalCapacityComplexStructs + 4096UL - 1UL) / 4096UL;
         Debug.Assert((stripeCount != 0) && ((stripeCount & (stripeCount - 1)) == 0), "stripeCount must be power of 2");
         this.smallArray = new Complex[stripeCount][];
         for (int stripe = 0; stripe < this.smallArray.Length; stripe++)
         {
             this.smallArray[stripe] = new Complex[Math.Min(totalCapacityComplexStructs, 4096UL)];
         }
     }
     else
     {
         this.largeArray = new ComplexArray2MeC(totalCapacityComplexStructs);
     }
 }
Example #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (smallArray != null || largeArray != null)
     {
         if (disposing)
         {
             if (!lightWeight)
             {
                 largeArray.Dispose();
             }
             smallArray = null;
             largeArray = null;
         }
     }
 }