示例#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();
		}
 /// <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;
 }
示例#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;
 }
示例#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();
 }
示例#5
0
		/// <param name="memoryModel">MemoryModel to use for primitive object sizes.
		/// </param>
		public RamUsageEstimator(MemoryModel memoryModel):this(memoryModel, true)
		{
		}
 /// <param name="memoryModel">MemoryModel to use for primitive object sizes.
 /// </param>
 public RamUsageEstimator(MemoryModel memoryModel) : this(memoryModel, true)
 {
 }