Ejemplo n.º 1
0
		/// <param name="memoryModel">MemoryModel to use for primitive object sizes.
		/// </param>
		/// <param name="checkInterned">check if Strings are interned and don't add to size
		/// if they are. Defaults to true but if you know the objects you are checking
		/// won't likely contain many interned Strings, it will be faster to turn off
		/// intern checking.
		/// </param>
		public RamUsageEstimator(MemoryModel memoryModel, bool checkInterned)
		{
			this.memoryModel = memoryModel;
			this.checkInterned = checkInterned;
			// Use Map rather than Set so that we can use an IdentityHashMap - not
			// seeing an IdentityHashSet
            seen = new System.Collections.Hashtable(64);    // {{Aroush-2.9}} Port issue; need to mimic java's IdentityHashMap equals() through C#'s Equals()
			this.refSize = memoryModel.GetReferenceSize();
			this.arraySize = memoryModel.GetArraySize();
			this.classSize = memoryModel.GetClassSize();
		}
Ejemplo n.º 2
0
 /// <param name="memoryModel">MemoryModel to use for primitive object sizes.
 /// </param>
 /// <param name="checkInterned">check if Strings are interned and don't add to size
 /// if they are. Defaults to true but if you know the objects you are checking
 /// won't likely contain many interned Strings, it will be faster to turn off
 /// intern checking.
 /// </param>
 public RamUsageEstimator(MemoryModel memoryModel, bool checkInterned)
 {
     this.memoryModel   = memoryModel;
     this.checkInterned = checkInterned;
     // Use Map rather than Set so that we can use an IdentityHashMap - not
     // seeing an IdentityHashSet
     seen           = new Dictionary <object, object>(64, IdentityStructComparer <object> .Default);
     this.refSize   = memoryModel.ReferenceSize;
     this.arraySize = memoryModel.ArraySize;
     this.classSize = memoryModel.ClassSize;
 }
Ejemplo n.º 3
0
 /// <param name="memoryModel">MemoryModel to use for primitive object sizes.
 /// </param>
 /// <param name="checkInterned">check if Strings are interned and don't add to size
 /// if they are. Defaults to true but if you know the objects you are checking
 /// won't likely contain many interned Strings, it will be faster to turn off
 /// intern checking.
 /// </param>
 public RamUsageEstimator(MemoryModel memoryModel, bool checkInterned)
 {
     this.memoryModel = memoryModel;
     this.checkInterned = checkInterned;
     // Use Map rather than Set so that we can use an IdentityHashMap - not
     // seeing an IdentityHashSet
     seen = new IdentityDictionary<object, object>(64);
     this.refSize = memoryModel.ReferenceSize;
     this.arraySize = memoryModel.ArraySize;
     this.classSize = memoryModel.ClassSize;
 }
Ejemplo n.º 4
0
 /// <param name="memoryModel">MemoryModel to use for primitive object sizes.
 /// </param>
 /// <param name="checkInterned">check if Strings are interned and don't add to size
 /// if they are. Defaults to true but if you know the objects you are checking
 /// won't likely contain many interned Strings, it will be faster to turn off
 /// intern checking.
 /// </param>
 public RamUsageEstimator(MemoryModel memoryModel, bool checkInterned)
 {
     this.memoryModel   = memoryModel;
     this.checkInterned = checkInterned;
     // Use Map rather than Set so that we can use an IdentityHashMap - not
     // seeing an IdentityHashSet
     seen           = new System.Collections.Hashtable(64); // {{Aroush-2.9}} Port issue; need to mimic java's IdentityHashMap equals() through C#'s Equals()
     this.refSize   = memoryModel.GetReferenceSize();
     this.arraySize = memoryModel.GetArraySize();
     this.classSize = memoryModel.GetClassSize();
 }
Ejemplo n.º 5
0
		/// <param name="memoryModel">MemoryModel to use for primitive object sizes.
		/// </param>
		public RamUsageEstimator(MemoryModel memoryModel):this(memoryModel, true)
		{
		}
Ejemplo n.º 6
0
 /// <param name="memoryModel">MemoryModel to use for primitive object sizes.
 /// </param>
 public RamUsageEstimator(MemoryModel memoryModel) : this(memoryModel, true)
 {
 }